PHP/Utility Function/parse str
Версия от 10:37, 26 мая 2010; (обсуждение)
Pass an array as the second parameter to parse_str( ), and it will put the variables into there
<?
$array = array( );
if (isset($array["foo"])) {
print "Foo is {$array["foo"]}<br />";
} else {
print "Foo is unset<br />";
}
parse_str("foo=bar&bar=baz", $array);
if (isset($array["foo"])) {
print "Foo is {$array["foo"]}<br />";
} else {
print "Foo is unset<br />";
}
?>
void parse_str ( string str [, array &arr] ) take a query string and convert it to variables
<?
if (isset($foo)) {
print "Foo is $foo<br />";
} else {
print "Foo is unset<br />";
}
parse_str("foo=bar&bar=baz");
if (isset($foo)) {
print "Foo is $foo<br />";
} else {
print "Foo is unset<br />";
}
?>