note 114225 added to class.arrayaccess
| From: | php at lanar dot com dot au | Date: | Mon, 27 Jan 2014 01:35:25 +0000 |
| Subject: | note 114225 added to class.arrayaccess | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198356@lists.php.net to get a copy of this message | ||
Objects implementing ArrayAccess do not support the increment/decrement operators ++ and --, unlike
array() and ArrayObject()
<?php
class MyArray implements ArrayAccess
{
// offsetSet, offsetGet etc implemented
}
$x = new MyArray() ;
$x[0] = 0 ;
$x[0]++ ; //error 'Indirect modification of overloaded element has no effect'
$x[0] += 1 ; // this works OK.
?>
----
Server IP: 113.20.13.217
Probable Submitter: 114.76.128.172
----
Manual Page -- http://php.net/manual/en/class.arrayaccess.php
Edit -- https://master.php.net/note/edit/114225
Del: integrated -- https://master.php.net/note/delete/114225/integrated
Del: useless -- https://master.php.net/note/delete/114225/useless
Del: bad code -- https://master.php.net/note/delete/114225/bad+code
Del: spam -- https://master.php.net/note/delete/114225/spam
Del: non-english -- https://master.php.net/note/delete/114225/non-english
Del: in docs -- https://master.php.net/note/delete/114225/in+docs
Del: other reasons-- https://master.php.net/note/delete/114225
Reject -- https://master.php.net/note/reject/114225
Search -- https://master.php.net/manage/user-notes.php