View Full Version : What does empty delimiter mean?

04-17-2012, 07:19 PM
I am getting this warning from a script that is running a foreach loop
so I don't know which loop is causing this 'Warning', nor why:

Warning: strpos() [function.strpos]: Empty delimiter in (script file;line indicated)

The php manual does not indicate in the entry for strpos, which is the delimiter argument. Or is it an argument?

04-17-2012, 07:39 PM
yes it does;

int strpos ( string $haystack , mixed $needle [, int $offset= 0 ] )

in this case the delimiter would be the $needle.

04-17-2012, 07:49 PM
Thanks, It is just that I did not see the term 'delimiter' used explicitly
in the manual entry. I traced the problem to an empty textarea form field.
so the problem appears to be:

if(strpos($_itemInspected[$_loopIterator], $_emptyFormField) > -1)
// proceed

04-17-2012, 08:37 PM
What is this: > -1? Don't use that. 0 is a valid position, but false is autocast as 0 during a comparison. Use !== false instead.