+ 1

Array Object in PHP

Can u explain deatils of arrayObject of php with example?

29th Jul 2018, 7:48 AM
Anwar Muhammad
Anwar Muhammad - avatar
2 Respuestas
+ 2
ArrayObjyect is just an object that behaves like an array . $userdata = array('firstname' => 'John', 'lastname' => 'Doe'); $arrayObject = new ArrayObject($userdata, ArrayObject::ARRAY_AS_PROPS); foreach ($arrayObject as $k => $v ) { echo 'key '.$k.' value '.$v ; } key firstname value John key lastname value Doe
30th Jul 2018, 1:36 AM
S1M0
S1M0 - avatar
0
nice, but can u do it with arrayObject 's property, i mean without using foreach?
30th Jul 2018, 2:35 AM
Anwar Muhammad
Anwar Muhammad - avatar