+ 1
Array Object in PHP
Can u explain deatils of arrayObject of php with example?
2 odpowiedzi
+ 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
0
nice, but can u do it with arrayObject 's property, i mean without using foreach?