note 84626 modified in ref.spl by thiago

From: Date: Tue, 22 Jul 2008 16:41:19 +0000
Subject: note 84626 modified in ref.spl by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142504@lists.php.net to get a copy of this message
The following construct allows to represent multidimensinal arrays using ArrayObject: <?php class ArrayMultiObject extends ArrayObject { function __construct($array, $flags = 0, $iterator_class = "ArrayIterator") { $objects = array(); foreach($array AS $key => $value) { if(is_array($value)) { $objects[$key] = new MultiArray($value, $flags, $iterator_class); } else { $objects[$key] = $value; } } parent::__construct($objects, $flags, $iterator_class); } } ?> --was-- The following construct allows to represent multidimensinal arrays using ArrayObject: class ArrayMultiObject extends ArrayObject { function __construct($array, $flags = 0, $iterator_class = "ArrayIterator") { $objects = array(); foreach($array AS $key => $value) { if(is_array($value)) { $objects[$key] = new MultiArray($value, $flags, $iterator_class); } else { $objects[$key] = $value; } } parent::__construct($objects, $flags, $iterator_class); } } http://php.net/manual/en/ref.spl.php

« previous php.notes (#142504) next »