Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- parsing a string for keywords
January 27, 2007, 8:16 pm
rate this thread
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 of 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 suggest an easier way
thanks in advance.
Re: parsing a string for keywords
You could iterate through your arrays, changing the case of each
element to lower/higher, and then compare with array_intersect. If you
just put strtolower() around the second argument of explode, that
should take care of that array. You could use array_map for the