Since PHP 8.1, passing null to parameter #1 is deprecated.
Example: when using strpos()
to find the occurrence of the specific word in the string.
$contains = 'are';
if (strpos( $value, $contins) !== false) {
echo 'true';
}
In case of $value
being null — the above deprecated message will appear.
Fix:
– Make sure the 1st parameter is a string.
or,
if ( $value && strpos( $value, $contins) !== false) {
echo 'true';
}
Did you know? In str_replace(), passing null to parameter #3 ($subject) of type array|string is deprecated
[Fix] strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated