I want to split the parameters sent through URL. Here is my text.
"mytext=A & B Company&anothertext=20&texttwo=SampleText&array[1]=10&array[2]=20"
Expected output:
['mytext'=>'A & B Company', 'anothertext'=> 20, 'texttwo' => 'SampleText', array[1] => 10, array[2] => 20 ].
I tried with explode('&', $params)
and parse_str($url_components['query'], $params)
;
both giving only A
as result. I need as 'A & B Company'
. How to achieve this?