note 119401 added to class.arrayaccess

From: Date: Sat, 28 May 2016 21:51:05 +0000
Subject: note 119401 added to class.arrayaccess
Groups: php.notes 
Request: Send a blank email to php-notes+get-205603@lists.php.net to get a copy of this message
Note, that the ArrayAccess class is not limited to scalar keys: <?php class A implements ArrayAccess { function offsetSet($a, $b) { var_dump(func_get_args()); } function offsetGet($a) { var_dump(func_get_args()); } function offsetExists($a) { var_dump(func_get_args()); } function offsetUnset($a) { var_dump(func_get_args()); } } class B{} class C{} $A = new A; $A[[1,2,3]] = [4,5,6]; $A[new B] = new C; /* array(2) { [0]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } [1]=> array(3) { [0]=> int(4) [1]=> int(5) [2]=> int(6) } } array(2) { [0]=> object(web\B)#3 (0) { } [1]=> object(web\C)#4 (0) { } } */ ?> ---- Server IP: 72.52.91.14 Probable Submitter: 109.91.60.136 ---- Manual Page -- http://php.net/manual/en/class.arrayaccess.php Edit -- https://master.php.net/note/edit/119401 Del: integrated -- https://master.php.net/note/delete/119401/integrated Del: useless -- https://master.php.net/note/delete/119401/useless Del: bad code -- https://master.php.net/note/delete/119401/bad+code Del: spam -- https://master.php.net/note/delete/119401/spam Del: non-english -- https://master.php.net/note/delete/119401/non-english Del: in docs -- https://master.php.net/note/delete/119401/in+docs Del: other reasons-- https://master.php.net/note/delete/119401 Reject -- https://master.php.net/note/reject/119401 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205603) next »