php - How to parse string to array -



php - How to parse string to array -

i have string 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 parse array in php. how ?. help much.

you utilize parse_str 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 can parse 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

php parsing

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -