strlen
function worked like C standard library strlen
, the result here would be wrong:$str = "abc\x00abc";
echo strlen($str); //gives 7, not 3!
<?php
$string1 = "Hello";
$string2 = "Hello\x00World";
// This function is NOT ! binary safe
echo strcoll($string1, $string2); // gives 0, strings are equal.
// This function is binary safe
echo strcmp($string1, $string2); // gives <0, $string1 is less than $string2.
?>
\x
indicates hexadecimal notation. See: PHP strings0x00 = NULL
0x04 = EOT (End of transmission)
Labels: PHP, Web development