Anonymous
public text v1 · immutable<?php
function build_global_list($parent, &$list, &$i, $array){
echo "$i\n";
foreach ($array as $key => $value){
$i++;
if (is_array($value)) {
$list[] = array('id' => $i, 'parent' => $parent, 'data' => $key);
build_global_list($i, $list, $i, $value);
}else{
$list[] = array('id' => $i, 'parent' => $parent, 'data' => $key);
}
}
echo "Leave build_global_list\n";
}
$list = array();
$i = 0;
build_global_list($i,$list,$i,$GLOBALS);
?>