Use split and replace array key?

0

By using the split function in a string obviously the keys will be enumerated from 0 to ... but I would like to choose what the key should be, using just one of the words that will be in the string, example to help simplify :

$string = "key1=xxx&key2=xxx&key3=xxx&key4=xxx ...";

When using split separating the string in & I would like the keys to be sorted according to the "key" and look like this:

Array
(
    [key1] => xxx1
    [key2] => xxx2
    [key3] => xxx3
    [key4] => xxx4
)

How can I do this?

    
asked by anonymous 16.12.2016 / 21:50

0 answers