- var_dump: documentation ( source)
<?php
$arr = array(
'a' => 'A',
'b' => 'B',
'c' => 'C');
var_dump($arr);
// Taking "$val" as a reference here allows modifying the parent hashtable
// directly, i.e. the $val ref "knows" its parent key in some sense
foreach ($arr as &$val) {
if ($val == 'B') {
$val = 'X';
}
}
var_dump($arr);
// However, it doesn't allow you to unset the parent key...
foreach ($arr as &$val) {
if ($val == 'A') {
unset($val);
}
}
var_dump($arr);