Tag:Ergodic class

  • PHP array traversal class and usage example

    Time:2019-10-9

    This paper describes the traversal classes and usage of PHP arrays with examples. Share for your reference, as follows: <?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; } […]