Aug 222010
Convert array to object in PHP
Answer:
It is easy to cast an object to an array in PHP, using the following method.
<?php
$obj = new stdClass();
$obj->foo = "foo";
$obj->bar = "bar";
var_dump ( (array) $obj );
It will print out...
array(2) {
["foo"]=>
string(3) "foo"
["bar"]=>
string(3) "bar"
}