I have a variable which always contains one of these two cases:
false
- A number (it can be also
0
)
My variable in reality is this:
$index = array_search(1, array_column($var, 'box'));
//=> the output could be something like these: false, 0, 1, 2, ...
Now I want to detect $index
is false
or anything else. How can I implement such a condition?
It should be noted none of these doesn't work:
if ( empty($index) ) { }
if ( !isset($index) ) { }
if ( is_null($index) ) { }
And I want this condition:
if ( ? ) { // $index is false } else { // $index is a number (even 0) }