I was looking for a function that deletes either integer keys or string keys (needed for my caching).
As I didn't find a function I came up with my own solution.
I didn't find the propiest function to post to so I will post it here, hope you find it useful.
<?php
function array_extract($array, $extract_type = 1)
{
foreach ( $array as $key => $value )
{
if ( $extract_type == 1 && is_string($key) )
{
unset($array[$key]);
}
elseif ( $extract_type == 2 && is_int($key) )
{
unset($array[$key]);
}
}
return $array;
}
?>
You can of course define constants to have a nicer look, I have chosen these: EXTR_INT = 1; EXTR_STRING = 2
EXTR_INT will return an array where keys are only integer while
EXTR_STRING will return an array where keys are only string
Have fun with it.