text: Q:
  
  How to parse string to array
  
  I have a string like this:
  "birs_appointment_price=&birs_appointment_duration=&birs_appointment_alternative_staff=&birs_shortcode_page_url=http%3A%2F%2Flocalhost%2Fstreamline-new%2Fworkshop%2F&_wpnonce=855cbbdefa&_wp_http_referer=%2Fstreamline-new%2Fworkshop%2F&birs_appointment_location=17858&birs_appointment_staff=-1&birs_appointment_avaliable_staff=-1%2C17859&birs_appointment_service=-1&birs_appointment_date=&birs_appointment_notes=&birs_appointment_fields%5B%5D=_birs_appointment_notes&birs_client_type=new&birs_client_name_first=&birs_client_fields%5B%5D=_birs_client_name_first&birs_client_name_last=&birs_client_fields%5B%5D=_birs_client_name_last&birs_client_email=&birs_client_fields%5B%5D=_birs_client_email&birs_field_1=&birs_client_fields%5B%5D=_birs_field_1&birs_client_fields%5B%5D=_birs_field_6&s="
  
  I want to parse it to array in php. How to do it ?. Thanks for your help so much.
  
  A:
  
  You use parse_str for this. (http://php.net/manual/en/function.parse-str.php)
  $output = array();
  parse_str($str, $output);
  echo $output['first'];  // value
  echo $output['arr'][0]; // foo bar
  echo $output['arr'][1]; // baz
  
  Or you can parse it into local variables
  $str = "first=value&arr[]=foo+bar&arr[]=baz";
  parse_str($str);
  echo $first;  // value
  echo $arr[0]; // foo bar
  echo $arr[1]; // baz
  
  