php - How to set array key same as value -
i have question seems obvious can't reproduce yet. well, let's have array:
$array = ('apple', 'orange', 'banana'); so have same array same keys values, this:
array( 'apple' => 'apple', 'orange' => 'orange', 'banana' => 'banana' ); how that?
$array = array('first','second','third'); $newarray = array(); foreach($array $value) { $newarray[$value] = $value; } or initialize array wanted to:
$array = array( 'first' => 'first', 'second' => 'second' ); wiki
Comments
Post a Comment