Slide 20
Slide 20 text
Changes in Handling of Numbers [2]
function foo(int $i) { var_dump($i); }
foo("123"); // int(123)
foo(" 123"); // int(123)
foo("123 "); // int(123) - PHP < 8: E_NOTICE, PHP 8+: no notice
foo("123abc"); // int(123) - PHP < 8: E_NOTICE, PHP 8+: TypeError
foo("string"); // TypeError
$a = 123 + "123"; // int(246)
$a = 123 + " 123";
$a = 123 + "123 "; // PHP < 8: E_NOTICE, PHP 8+: no notice
$a = 123 + "123abc"; // PHP < 8: E_NOTICE, PHP 8+: E_WARNING
$a = 123 + "string"; // int(123) - PHP < 8: E_WARNING,
// PHP 8+: TypeError