I have a weird result in PHP.
if( $mandatory_param === "name" ){
var_dump( $data );
exit();
}
//output : array(6) { ["name"]=> string(4) "plan" ["class"]=> string(33) "Path\Plan" ["dbtable"]=> string(5) "plans" ["getter"]=> string(7) "plan_id" ["editable"]=> string(4) "true" ["slug"]=> string(2) "pl" }
But when I try the empty
function to test the array, the result change even if the first output show this : ["name"]=> string(4) "plan"
if( $mandatory_param === "name" && empty( $data[ $mandatory_param ] ) ){
var_dump( $data );
exit();
}
//Output : array(0) { }
Why ? The empty()
function seems to empty my array not to check if it´s empty.
$mandatory_param
and$data
.