PHP dereference array elements

Not sure I totally understand the question, but can you use recursion?

function array_copy($source) {
    $arr = array();

    foreach ($source as $element) {
        if (is_array($element)) {
            $arr[] = array_copy($element);
        } else {
            $arr[] = $element;
        }
    }

    return $arr;
}

$result = array();
$row = array(
    array('a', 'b', 'c'),
    array('d', 'e', 'f')
);

$result[] = array_copy($row);

$row[0][1] = 'x';

var_dump($result);
var_dump($row);

Extending the function above like follows solved a problem I had:

function array_copy($source) {
    $arr = array();

    foreach ($source as $element) {
        if (is_array($element)) {
            $arr[] = array_copy($element);
        } elseif (is_object($element)) {
            // make an object copy
            $arr[] = clone $element;
        } else {
            $arr[] = $element;
        }
    }
    return $arr;
}