I have this string :
0=&task=rose&duration=1.25&user=15&1=&task=daisy&duration=0.75&user=25&2=&task=orchid&duration=1.15&user=7
I want this array structure :
array(
array( "task" => "rose",
"duration" => 1.25,
"user" => 15
),
array( "task" => "daisy",
"duration" => 0.75,
"user" => 25,
),
array( "task" => "orchid",
"duration" => 1.15,
"user" => 7
)
)
Now
parse_urlwon’t work for your case, as it will overwrite the duplicate entries. You have to manually extract and group here.The trick is watching out for the numeric keys (sans value), which separate your groups. The loop will generate following nested array: