How to catch these PHP Warnings?

81 views Asked by At

After reading about the ... splat operator here: https://stackoverflow.com/a/56634367/429523

I decided to do this:

if (isset($some_array) && is_array($some_array)) {
    if (in_array($needle, array_merge(...$some_array), true)) {
        // do stuff...
    }
}

I'm receiving warnings like this:

PHP Warning: array_merge() expects at least 1 parameter, 0 given in...

PHP Warning: in_array() expects parameter 2 to be array, null given in...

How are these warnings getting past the isset / is_array if condition?

0

There are 0 answers