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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -