In PHP 5.0.4, at least, one CAN unset array elements inside functions from arrays passed by reference to the function.
As implied by the manual, however, one can't unset the entire array by passing it by reference.
<?php
function remove_variable (&$variable) {
unset($variable);
}
function remove_element (&$array, $key) {
unset($array[$key]);
}
$scalar = 'Hello, there';
echo 'Value of $scalar is: ';
print_r ($scalar); echo '<br />';
remove_variable($scalar); echo 'Value of $scalar is: ';
print_r ($scalar); echo '<br />';
$array = array('one' => 1, 'two' => 2, 'three' => 3);
echo 'Value of $array is: ';
print_r ($array); echo '<br />';
remove_variable($array); echo 'Value of $array is: ';
print_r ($array); echo '<br />';
remove_element($array, 'two'); echo 'Value of $array is: ';
print_r ($array); echo '<br />';
?>