I have these urlencode from Postmant:
rq_uuid=e53473de-0483-44f5-91f0-2be74e58c277&rq_datetime =2022-03-09 16:33:16&sender_id=TESS&receiver_id=SGRQWES
How can I convert this URLENCODE in an array in PHP so i will have an array like this :
array( 'rq_uuid' => 'e53473de-0483-44f5-91f0-2be74e58c277', 'rq_datetime' => '2022-03-09 16:33:16', 'sender_id' => 'TESS', 'receiver_id' => 'SGRQWES', etc.. )
Advertisement
Answer
parse_str parses string as if it were the query string passed via a URL and sets variables in the current scope (or in the array if result is provided).
https://www.php.net/manual/en/function.parse-str.php
parse_str("rq_uuid=e53473de-0483-44f5-91f0-2be74e58c277& =2022-03-09 16:33:16&sender_id=TESS&receiver_id=SGRQWES", $arr_params); print "<pre>"; print_r ($arr_params); print "</pre>";