?php
class scanArray{
public $arr;
public $where;
private $str;
public function scan($arr,$where="array"){
$this->arr = $arr;
$this->where = $where;
foreach($this->arr as $k=>$v){
if(is_array($v)){
$this->where = ($this->where)."[{$k}]";
$this->scan($v,$this->where);
}else{
$this->str .= $this->where."[{$k}]=".$v.'br />';
}
}
return $this->str;
}
function __destruct(){
unset($this->arr);
unset($this->where);
}
}
$a = array('g'=>"a",'vv'=>array("b"=>"b","l"=>"c","xx"=>array("e","g")));
$ah = new scanArray();
$b = $ah->scan($a);
echo $b;
更多關于PHP相關內(nèi)容感興趣的讀者可查看本站專題:《PHP數(shù)組(Array)操作技巧大全》、《php排序算法總結(jié)》、《PHP數(shù)據(jù)結(jié)構與算法教程》、《php程序設計算法總結(jié)》、《php字符串(string)用法總結(jié)》及《PHP常用遍歷算法與技巧總結(jié)》