fork download
  1. <?php
  2. $input = array(
  3. 0 => 'Foo',
  4. 1 => 'Bar'
  5. );
  6.  
  7. $newArray = array();
  8.  
  9. foreach($input as $key => $value) {
  10. $newArray[$key] = $value;
  11. }
  12.  
  13. die('<pre>' . print_r($newArray, true) . '</pre>');
Success #stdin #stdout 0.02s 24532KB
stdin
Standard input is empty
stdout
<pre>Array
(
    [0] => Foo
    [1] => Bar
)
</pre>