Without changing the signatures of the function, I want the PHP function to behave differently if a linked array is specified instead of a regular array.
Note. . You can assume that arrays are homogeneous. For example, array(1,2,"foo" => "bar")it is not accepted and can be ignored.
function my_func(Array $foo){
if (…) {
echo "Found associated array";
}
else {
echo "Found regular array";
}
}
my_func(array("foo" => "bar", "hello" => "world"));
my_func(array(1,2,3,4));
Is this possible with PHP?
maček source
share