I had this question before, and it was concluded that it was a mistake in 5.2.5. Well, it is still broken in 5.2.6, at least for me:
Please let me know if it is broken or working for you:
$obj = new stdClass();
$obj->{"foo"} = "bar";
$obj->{"0"} = "zero";
$arr = (array)$obj;
foreach ($arr as $key=>$value){
echo "$key -- " . $arr[$key] . "\n";
}
Any ways to “fix” an array after it has been ported from stdClass?
John ii
source
share