1.2.1657. strpos() With Integers¶
strpos() used to accept integer as second argument, and turn them into their ASCII equivalent. This was deprecated in PHP 7.x, and dropped in 8.0.
It is recommended to use casting to ensure the variable is actually strings, and strpos() behaves as expected.
<?php
strpos('abc ', 32);
// PHP 8.0+ : false, 32 is not found
// PHP 7.4- : 3, 32 is turned into space, then found
?>