php-src
php-src copied to clipboard
'\0' is 0 or !0
Description
The following code:
<?php
$str = '\0';
$n = 0;
$flag = ($str == $n);
echo $flag, "\n";
if ($str)
{
echo "yes\n";
}
else
{
echo "no\n";
}
?>
Resulted in this output:
1
yes
But I expected this output instead:
PHP Version
PHP5.4.16
Operating System
centos7
Hi @wuyx1! This hasn't been the case since PHP 8.0. https://3v4l.org/JZOtk Support for PHP 5.4 is long long gone.