You are here: Re: Shorten this line? « PHP Programming Language « IT news, forums, messages
Re: Shorten this line?

Posted by shimmyshack on 05/16/07 09:52

On May 16, 10:05 am, UKuser <spiderc...@yahoo.co.uk> wrote:
> On 16 May, 09:52, "Rami Elomaa" <rami.elo...@gmail.com> wrote:
>
>
>
> > "UKuser" <spiderc...@yahoo.co.uk> wrote in message
>
> >news:1179305059.030405.170200@q23g2000hsg.googlegroups.com...
>
> > > Hi,
>
> > > Is there a way to shorten this line
>
> > > if ((ereg(".jpg",$filename))||(ereg(".eps",$filename))||(ereg(".tif",
> > > $filename))||(ereg(".tiff",$filename))||(ereg(".jpeg",$filename))||
> > > (ereg(".ai",$filename))) {
>
> > if(preg_match('#.+\.(jpg|jpeg|eps|tif|tiff|ai)$#', $filename)){
>
> > --
> > Rami.Elo...@gmail.com
>
> > "Good tea. Nice house." -- Worf
>
> Thanks for that!
>
> A

you can still shorten it a teeny bit more, by
\.(jpe?g|eps|tiff?|ai)$
instead of
..+\.(jpg|jpeg|eps|tif|tiff|ai)$
buy hey who cares right

 

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

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