On Wednesday 18 February 2004 12:03 pm, Ben Ramsey wrote:
> You might be able to create some function that uses a combination of
> array_keys(), array_values(), and array_combine() to do what you want.
> Check the manual at http://www.php.net/array for more information on
> these functions.
>
True, but I was looking to see if I could avoid running a loop, of which I
would still have to loop over the result of array_keys() to modify its
content.
So for now, Im running ->
function modify_key($array)
{
$array = (array)$array;
foreach($array as $key => $value)
{
if (FALSE === ($pos = $strpos($key, '.')))
{
continue;
}
$new_key = substr($key, $pos + 1);
$array[ $new_key ] = $value;
unset( $array[ $key ] );
}
return $array;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php