fork(1) download
  1. <?php
  2.  
  3. $old = array('white', 'blue', 'black');
  4. $newArray = array();
  5.  
  6. foreach($old as $value){
  7. $newArray["$value"] = $value;
  8. }
  9. var_dump($newArray);
Success #stdin #stdout 0.01s 24400KB
stdin
Standard input is empty
stdout
array(3) {
  ["white"]=>
  string(5) "white"
  ["blue"]=>
  string(4) "blue"
  ["black"]=>
  string(5) "black"
}