/hphp/test/slow/array_object/exchangeArray.php

http://github.com/facebook/hiphop-php · PHP · 13 lines · 7 code · 3 blank · 3 comment · 0 complexity · d35e758259ad15f57502a8c537cf037e MD5 · raw file

  1. <?php
  2. // Array of available fruits
  3. $fruits = array("lemons" => 1, "oranges" => 4, "bananas" => 5, "apples" => 10);
  4. // Array of locations in Europe
  5. $locations = array('Amsterdam', 'Paris', 'London');
  6. $fruitsArrayObject = new ArrayObject($fruits);
  7. // Now exchange fruits for locations
  8. $old = $fruitsArrayObject->exchangeArray($locations);
  9. print_r($old);
  10. print_r($fruitsArrayObject);