Re: Patterns
| From: | Daniel Brown | 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:No problemo. Just remember, only .php files will match the first case, while anything containingGreetings. I just want to say thanks for the help over the past coupleofdays. 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 certainfolder.However, if the file ends in .html or .htm, I want it to unlink fromanotherfolder. 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.... willalso do .phtml, etc. } ?>It's the file for which you want to check the extension. Sorryabout 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.
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