Category:php functions

parse_str

How to use parse_str()

parse_str(string $str [,array &$arr ])

 <?php

$string = 'firstVar=first&secondVar=second&thirdVar=third';

parse_str($string);

echo $firstVar; // outputs first

echo firstVar; // outputs second

echo firstVar; // outputs third

?>

The pars_str() php function converts the string variables into php variables with the same name that the string variable was . This is very useful for parameters that are passed via a URL string. Url arguments begin after the "?". Each variable is separated using the "&" character.

Author: D.Shaun Morgan