<p>I had this question earlier and it was concluded it was a bug in 5.2.5.  Well, it's still broken in 5.2.6, at least for me:</p>

<p>Please let me know if it is broken or works for you:</p>

<pre><code>$obj = new stdClass();
$obj-&gt;{"foo"} = "bar";
$obj-&gt;{"0"} = "zero";
$arr = (array)$obj;

//foo -- bar
//0 --    {error: undefined index}
foreach ($arr as $key=&gt;$value){
    echo "$key -- " . $arr[$key] . "\n";
}
</code></pre>

<p>Any ways to "fix" the array after it has been cast from a stdClass?</p>

Definitely seems like a bug to me (PHP 5.2.6).
You can fix the array like this:
```
```
$arr = array_combine(array_keys($arr), array_values($arr));
```
```
It's been reported in
this bug report
but marked as bogus...
the documentation
says:
The keys are the member variable
  names, with a few notable exceptions:
  integer properties are unaccessible;