clay1 Posted March 12, 2010 Share Posted March 12, 2010 I need to take a string and separate it into a set of variables or an associative array &Accepted=1&Accepted_msg=Warning%20dialer%5Fsource%5Fid%20is%200&error=0&Error_desc= The fields are delimited by & I'd like to get that to be something like: $accepted = 1 $accepted_message = "warning dialer source..' $error_desc = Quote Link to comment https://forums.phpfreaks.com/topic/195063-parse-string-into-variables/ Share on other sites More sharing options...
wildteen88 Posted March 12, 2010 Share Posted March 12, 2010 You could use parse_str, example $str = 'Accepted=1&Accepted_msg=Warning%20dialer%5Fsource%5Fid%20is%200&error=0&Error_desc='; parse_str($str, $output); echo '<pre>'.print_r($outout, true).'</pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/195063-parse-string-into-variables/#findComment-1025387 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.