ID: 34976
Updated by: [EMAIL PROTECTED]
Reported By: mikael at chl dot chalmers dot se
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: Linux
PHP Version: 4.4.0
New Comment:
"If needle is not a string, it is converted to an integer and applied
as the ordinal value of a character."
In your case needle is int(919400).
chr(919400) returns "h", so you got what you was looking for: "h" is
65-th symbol in your string.
Previous Comments:
------------------------------------------------------------------------
[2005-10-25 10:40:01] mikael at chl dot chalmers dot se
Description:
------------
When using strpos inside a foreach and the needle is the key of the
array being looped over one get strange return values. Not all key and
not all length of the haystack produces this result, and not all
needle/haystacks produce the same faulty return value
Reproduce code:
---------------
$maps = array('919400' => 'foo');
foreach ($maps as $orgnr => $foo)
var_dump(strpos('ou=000000,ou=000000,ou=000000,ou=0000000000,ou=organization,dc=chalmers,dc=se',
$orgnr));
Expected result:
----------------
bool(false)
Actual result:
--------------
int(64)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34976&edit=1