fork download
  1. <?php
  2. //Assigns 10 to test1. 20 to test2. 30 to test3.
  3. $array1 = array(10 => "test1", 20 => "test2", 30 => "test3");
  4. //Creates a blank array.
  5. $blank = new ArrayObject();
  6.  
  7. $blank->append(array("20")); //Adds the value 20, to the blank array.
  8. $blank->append(array("30")); //Adds the value 30, to the blank array.
  9.  
  10. print($array1[$blank[0][0]]); // should print "test2"
  11. print($array1[$blank[1][0]]); // should print "test3"
  12. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
test2test3