strlen(): Passing null to parameter #1 ($string) of type string is deprecated¶
Description¶
strlen() calculates the length of a string. It only works on strings, and, in particular, cannot compute the length of the null value.
Example¶
<?php
$s = null;
print strlen($s);
?>
Solutions¶
Process
nullin a separate branch of code.Convert
nullto the empty string before using strlen().