note 84627 added to ref.spl

From: Date: Tue, 22 Jul 2008 16:56:04 +0000
Subject: note 84627 added to ref.spl
Groups: php.notes 
Request: Send a blank email to php-notes+get-142505@lists.php.net to get a copy of this message
I have to correct my implementation from before. The example before only supported correct read-access but failed on setting new values after creation of the ArrayMultiObject. Also i had to correct a bug that occured from my CopyPasteChange into the comment textarea. This snippet now hopefully implements a fully functional multidimensional array, represented by an 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 ArrayMultiObject($value, $flags, $iterator_class); } else { $objects[$key] = $value; } } parent::__construct($objects, $flags, $iterator_class); } public function offsetSet($name, $value) { if(is_array($value)) { $value = new ArrayMultiObject($value); } return parent::offsetSet($name, $value); } } ---- Server IP: 217.160.72.57 Probable Submitter: 77.11.21.155 ---- Manual Page -- http://www.php.net/manual/en/ref.spl.php Edit -- https://master.php.net/note/edit/84627 Del: integrated -- https://master.php.net/note/delete/84627/integrated Del: useless -- https://master.php.net/note/delete/84627/useless Del: bad code -- https://master.php.net/note/delete/84627/bad+code Del: spam -- https://master.php.net/note/delete/84627/spam Del: non-english -- https://master.php.net/note/delete/84627/non-english Del: in docs -- https://master.php.net/note/delete/84627/in+docs Del: other reasons-- https://master.php.net/note/delete/84627 Reject -- https://master.php.net/note/reject/84627 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142505) next »