I have the following array:
array('Elnett', 'INOA INOA', 'Playball P', 'Preferred Color Specialist', 
      'Série Expert', 'Série Nature', 'Techni art')
I would like to have keys and values like:
array('Elnett' => 'Elnett', 
      'INOA INOA' => 'INOA INOA', 
      'Playball P' => 'Playball', 
      'Preferred Color Specialis' => 'Preferred Color Specialist', 
      'Série Expert' => 'Série Expert', 
      'Série Nature' => 'Série Nature', 
      'Techni art' => 'Techni art')
How can I accomplish this?
There's array_combine to create a key/value array out of two arrays. Should be possible to use the same array for keys and values:
$names = array_combine($names, $names);
                        This one-line answer may be useful to someone.
$trans = array_flip($array);
http://us1.php.net/array_flip
array_flip returns the value=>key format of given key=>value array. as the question changed, this does not exactly answer the OP's question anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With