fork(19) download
  1. <pre>
  2. <?php
  3.  
  4. $arr = array('4' => 'foo', '4x' => 'bar');
  5. $obj = (object)$arr;
  6. print_r($obj);
  7.  
  8. echo "Let's say foo: \n".$obj->{'4'}."\n";
  9. echo "Let's say bar: \n".$obj->{'4x'}."\n";
  10.  
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
<pre>
stdClass Object
(
    [4] => foo
    [4x] => bar
)
Let's say foo: 

Let's say bar: 
bar