The parse_str() function is used to parse the string into variables. It returns nothing.
Syntax
parse_str(str, arr)
Parameters
str − The string to pass
arr − The name of an array to store the variables
Return
The parse_str() function returns nothing.
Example
The following is an example −
<?php parse_str("studentname=Jack&marks=95",$arr); print_r($arr); ?>
Output
The following is the output −
Array ( [studentname] => Jack [marks] => 95 )
Example
Let us see another example −
<?php parse_str("studentname=Tom&studentmarks=95&studentsubject=Maths", $arr); print_r($arr); ?>
Output
The following is the output −
Array ( [studentname] => Tom [studentmarks] => 95 [studentsubject] => Maths )