|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-07-12 18:47 UTC] eschmid at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 22:00:01 2025 UTC |
<? $string = "FOO STRING"; $string1 = "FOO"; $string2 = "OO"; $string3 = "ZOO"; $value1 = strpos($string,$string1,0); $value2 = strpos($string,$string2,0); $value3 = strpos($string,$string3,0); for ($i=1;$i<=3;$i++) { if (${value.$i}>=0) { echo "string".$i." found at:".${value.$i}."<br>"; } elseif (${value.$i}==FALSE) { echo "string".$i." not found.<br>"; } } ?> $value3>=0 and $value3==FALSE are equivalent and so we can not distinguish between string found at position 0 and string not found. strpos should return -1 when the string was not found.