ID:               30158
 Updated by:       [EMAIL PROTECTED]
 Reported By:      a dot bendilas at zefxis dot gr
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: WinXP SP2
 PHP Version:      4.3.8
 New Comment:

Why are you doing a === to true?  strpos is clearly documented to
return a integer specifying the position in the string on a match or
false on a failure.  It will never return true.


Previous Comments:
------------------------------------------------------------------------

[2004-09-19 22:09:19] a dot bendilas at zefxis dot gr

Description:
------------
Although strpos returns the position of the needle correctly, when
testing the return value with a boolean operator to see if it's true,
it produces the opposite result.

Reproduce code:
---------------
$string = 'Once upon a time in America';
$srchstring = 'time';
$position = strpos($string, $srchstring);

echo 'String: '.$string.'<br />';
echo 'Search string: '.$srchstring.'<br />';
echo 'Position of search string: '.$position.'<br />';

if ((strpos($string, $srchstring) === true)) echo 'Search string is
included in the original string!'; else echo 'Search string is not
included in the original string!';


Expected result:
----------------
Search string is included in the original string!

Actual result:
--------------
Search string is not included in the original string!


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30158&edit=1

Reply via email to