The parse_str () function parses the query string to the variable. syntax: parse_str (string, array) Note: If the array parameter is not set, the variable set by this function overwrites the variable with the same name. The instance code is as follows :... the parse_str () function parses the query string to the variable.
Syntax:Parse_str (string, array)
Note:If the array parameter is not set, the variable set by this function overwrites the variable with the same name. The instance code is as follows:
*/
Parse_str ("id = 23 & name = john % 20 adams"); echo $ id ."
"; Echo $ name; // 23 // john $ str =" first = value & arr [] = foo + bar & arr [] = baz "; // define the string parse_str ($ str); // Parse the string into the variable echo $ first; // output the value of $ first echo"
"; Echo $ arr [0]; // output the value of $ arr [0] foo bar echo"
"; Echo $ arr [1]; // outputs the value of $ arr [1] baz echo"
"; Parse_str ($ str, $ output); // store string-parsed variables in $ output echo $ output ['first']; // Output $ first value echo"
"; Echo $ output ['arr'] [0]; // output the value of $ arr [0] foo bar echo"
"; Echo $ output ['arr'] [1]; // outputs the value baz of $ arr [1 ].
/*
Note:The magic_quotes_gpc setting in php. ini affects the output of this function. if it is enabled, the variable will be converted by addslashes () before parse_str () is parsed.
Tutorial link:
Reprint at will ~ However, please keep the tutorial address★