You are here: Re: Using a simple regular expressions to check a filename has '.php' on the end of it « PHP Programming Language « IT news, forums, messages
Re: Using a simple regular expressions to check a filename has '.php' on the end of it

Posted by Jerry Stuckle on 01/08/08 13:14

bizt wrote:
> Hi,
>
> Im trying to write a regular expression in PHP to check if a submitted
> filename has .php on the end of it. For example, filename.html woulod
> return false whereas filename.php would return true.
>
> My code is:
>
> if (ereg ("$.php", $filename))
> return true;
> else
> return false;
>
> Obviously my expression is wrong, could someone please tell me what Im
> doing wrong. Thanks
>
> Burnsy
>

A regex is overkill for a simple string. strcmp() is better in this case.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация