<?php $old = array('white', 'blue', 'black');$newArray = array(); foreach($old as $value){$newArray["$value"] = $value;}var_dump($newArray);
Standard input is empty
array(3) { ["white"]=> string(5) "white" ["blue"]=> string(4) "blue" ["black"]=> string(5) "black" }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!