I have a string like this-
$string = 'Apple, Orange, Lemone';
I want to make this string to ::
$array = array('apple'=>'Apple', 'orang'=>'Orange', 'lemone'=>'Lemone');
How to achieve this
I used explode function like this
$string = explode(',', $string );
that gives me this- Array ( [0] => apple [1] => orang )
Somebody says this question is a duplicate of this SO question: How can I split a comma delimited string into an array in PHP?
that question not addressing my problem, I have already reached the answer of that question, please read my question. I needed to change that result arry's key value. see
Array
(
[0] => 9
[1] => admin@example.com
[2] => 8
)
to like this
Array
(
[9] => 9
[admin@example.com] => admin@example.com
[8] => 8
)