I'm seeing this error message at the top of my website:
Warning: in_array() expects parameter 2 to be array, null given in /home1/santikac/public_html/wp-content/plugins/jetpack/class.jetpack.php on line 1518
How do I resolve this warning?
I'm seeing this error message at the top of my website:
Warning: in_array() expects parameter 2 to be array, null given in /home1/santikac/public_html/wp-content/plugins/jetpack/class.jetpack.php on line 1518
How do I resolve this warning?
The function in_array()
accepts two parameters -
Also, there is an optional parameter -
$strict = FALSE;
Let's take an example:
$valueToSearch = "abc";
$arrayToSearch = array("acb", "abc", "dce");
echo in_array($valueToSearch, $arrayToSearch);
If you inspect the warning properly it tells you the method and the line number where the issue is coming. You can navigate to that particular line and try print_r()
with the variable passed to in_array()
and resolve the issue. If not, update your question with the outputs of print_r()
.