You are here: Re: parsing a string for keywords « PHP Programming Language « IT news, forums, messages
Re: parsing a string for keywords

Posted by Rik on 01/27/07 20:32

bill <nobody@spamcop.net> wrote:

> I need to parse a set of directory entries (of photo image files) and =
=

> pull out the names of the subjects, which is in the filename.
>
> A file name could contain 1 or more subject names from a limited set o=
f =

> 18 possibilities.
>
> eg: the possibilities might be: Aoife, Alana, Liam, Paddy.....
>
> the file name might be: 0709-Aoife-Alana-DSC12435.jpg
>
> I could do 18 stripos() calls to check for all 18 possibilities, but I=
=

> thought I would run it by the more experienced to see if you can sugge=
st =

> an easier way
>
> thanks in advance.

$possibities =3D array('foo','bar','baz'........);
$filenameparts =3D explode('-',$filename);
$matches =3D array_intersect($filenameparts,$possibities);
-- =

Rik Wasmus

 

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

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