...

View Full Version : What does empty delimiter mean?



anotherJEK
04-17-2012, 06: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?

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


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

in this case the delimiter would be the $needle.

anotherJEK
04-17-2012, 06: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
}

Fou-Lu
04-17-2012, 07: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum