note 127950 added to arrayobject.construct

From: Date: Mon, 21 Nov 2022 19:05:58 +0000
Subject: note 127950 added to arrayobject.construct
Groups: php.notes 
Request: Send a blank email to php-notes+get-219905@lists.php.net to get a copy of this message
An absolutely useless object. If you are creating some kind of object collection, then nested array elements should also be able to be represented in the parent type. Otherwise, all the flexibility of this solution is lost. <?php $cover = new \ArrayObject(['scalar' => true, 'arr' => []]); print_r($cover); ArrayObject Object ( [storage:ArrayObject:private] => Array ( [scalar] => 1 [arr] => Array() // WTF?! Why arr not ArrayObject type?! ) ) */ $cover['arr']->append(123); // Call to a member function append() on array ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.161 (proxied: 94.143.47.60) ---- Manual Page -- https://php.net/manual/en/arrayobject.construct.php Edit -- https://main.php.net/note/edit/127950 Del: integrated -- https://main.php.net/note/delete/127950/integrated Del: useless -- https://main.php.net/note/delete/127950/useless Del: bad code -- https://main.php.net/note/delete/127950/bad+code Del: spam -- https://main.php.net/note/delete/127950/spam Del: non-english -- https://main.php.net/note/delete/127950/non-english Del: in docs -- https://main.php.net/note/delete/127950/in+docs Del: other reasons-- https://main.php.net/note/delete/127950 Reject -- https://main.php.net/note/reject/127950 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219905) next »