Re: Patterns

From: Date: Thu, 07 Jun 2007 16:46:28 +0000
Subject: Re: Patterns
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-256299@lists.php.net to get a copy of this message
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.php',"."))); 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

« previous php.general (#256299) next »