What does if ($array){ } condition mean in php?
When is it true or false?
What does if ($array){ } condition mean in php?
When is it true or false?
The array will be casted to a boolean, like if you would use if((bool) $array) { }
false is returned when the array is empty (e.g. $array = [])
true is returned as soon as at least one key is set in the array (either like ["some value"] or ["data" => "value"]
You can simply test what the returned value will be by using
var_dump((bool) $your_array);