array_filter
only passes array values, not keynames... how to access keyname?
for example:
$array= array('country'=>'Spain');
array_filter($array,'my_func');
with my_func
i want to check:
if KEYNAME == 'country' then
...
array_filter
only passes array values, not keynames... how to access keyname?
for example:
$array= array('country'=>'Spain');
array_filter($array,'my_func');
with my_func
i want to check:
if KEYNAME == 'country' then
...
array_filter can pass them.
array_filter($array, 'my_func', ARRAY_FILTER_USE_BOTH);
and my_func
will then be passed two params; the key, and the value.