kuldeep dhaka wrote:
> /*
>  i was thinking if is their any function that can do the above work like
> */
> echo array_drill($array, array("school","class","roll_number","name"));

The following should work:

function array_drill($array, $keys) {
        while (($key = array_shift($keys)) !== null) {
                $array =& $array[$key];
        }
        return $array;
}

(Not tested. It will fail if the key doesn't exist, you can optionally
check that and fail however you'd like.)

-- 
Ryan McCue
<http://ryanmccue.info/>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to