needle is not a string or an integer

Description

The second argument may be a string, or an integer, which will be used as a string. Any other type is forbidden, in particular array. Other types may yield other error messages, such as a type error.

Example

<?php

print strpos('abc99', []);

?>

Solutions

  • Use a foreach on an array of strings, and use these values instead.

  • Pick up a value in the array.