/hphp/test/slow/array_object/exchangeArray.php
PHP | 13 lines | 7 code | 3 blank | 3 comment | 0 complexity | d35e758259ad15f57502a8c537cf037e MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?php
- // Array of available fruits
- $fruits = array("lemons" => 1, "oranges" => 4, "bananas" => 5, "apples" => 10);
- // Array of locations in Europe
- $locations = array('Amsterdam', 'Paris', 'London');
- $fruitsArrayObject = new ArrayObject($fruits);
- // Now exchange fruits for locations
- $old = $fruitsArrayObject->exchangeArray($locations);
- print_r($old);
- print_r($fruitsArrayObject);