Re: [PHP] Patterns

This is a discussion on Re: [PHP] Patterns within the PHP General forums, part of the PHP Programming Forums category; On 6/7/07, Steve Marquez <smarquez@marquez-design.com> wrote: > > Thank you very much! That ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-07-2007
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Patterns

On 6/7/07, Steve Marquez <smarquez@marquez-design.com> wrote:
>
> Thank you very much! That worked.
>
> --
> Steve M.
>
>
> on 6/7/07 11:31 AM Daniel Brown (parasane@gmail.com) wrote:
>
>
> On 6/7/07, Steve Marquez <smarquez@marquez-design.com> wrote:
> >
> > Is the "installer.php" my form file?
> >
> > --
> > Steve M.
> >
> > on 6/7/07 11:12 AM Daniel Brown (parasane@gmail.com) wrote:
> >
> >
> > On 6/7/07, Steve Marquez <smarquez@marquez-design.com> wrote:
> > > Greetings. I just want to say thanks for the help over the past couple

> of
> > > days.
> > >
> > > I am trying to get a form to delete a file.
> > >
> > > If the file ends in .php, then I want it to unlink from a certain

> folder.
> > > However, if the file ends in .html or .htm, I want it to unlink from

> > another
> > > folder.
> > >
> > > Is there any way to do this?
> > >
> > > Thanks,
> > >
> > > --
> > > Steve M.
> > >

> >
> > <?
> > $extension =
> >

> str_replace('.','',strtolower(strrchr('installer.p hp',".")));
> >
> > if($extension == "php") {
> > // Do your unlink() routine for PHP here.
> > } elseif(strstr($extension,"htm")) {
> > // Do your unlink() routine for .htm/.html files here.... will
> > also do .phtml, etc.
> > }
> > ?>
> >
> >
> >

>
> It's the file for which you want to check the extension. Sorry
> about that.... I typed the code into the email, then figured I should
> test it, and installer.php was the file I was currently writing in my
> Vim window, so I tested it on that.
>
>


No problemo. Just remember, only .php files will match the first
case, while anything containing `htm` will be included in the second
case (.htm, .html .phtml, .xhtml, et cetera). So you may need to
modify it a bit if you have certain cases where you want to remove all
..html files, for example, but not .phtml (an archaic PHP file
extension).

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:00 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0