<html>
<body>
<pre>
$a = array("Volvo", "BMW", "Toyota"); // indexed array
$b = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); // associative array
$a = (object) $a;
$b = (object) $b;
//To verify the type of any object in PHP, use the var_dump() function:
var_dump($a);
var_dump($b);
</pre>
<p>Indexed arrays converts into objects with the index number as property name and the value as property value.</p>
<p>Associative arrays converts into objects with the keys as property names and values as property values.</p>
</body>
</html>
object(stdClass)#1 (3) { [0]=> string(5) "Volvo" [1]=> string(3) "BMW" [2]=> string(6) "Toyota" } object(stdClass)#2 (3) { ["Peter"]=> string(2) "35" ["Ben"]=> string(2) "37" ["Joe"]=> string(2) "43" }
Indexed arrays converts into objects with the index number as property name and the value as property value.
Associative arrays converts into objects with the keys as property names and values as property values.