What does the foreach (Array (' _post ', ' _get ') as $_request) {//array (' _post ', ' _get ') write in this foreach loop mean? foreach ($$_request as $_key = $_value) {//Why is $$ represented above? $_key{0}! = ' _ ' && $$_key = xaddslashes ($_value); $_key{0} What does this {0} mean? }}
A php foreach question, please expert guidance, do not understand, I am a novice, but I still see this writing for the first time, do not understand, please pointing.
Reply to discussion (solution)
What does the foreach (Array (' _post ', ' _get ') as $_request) {//array (' _post ', ' _get ') write in this foreach loop mean? Array (' _post ', ' _get ') are arrays (just useless variable substitution) and of course can be written in foreach ($$_request as $_key = $_value) {// Why is there a $$ on the front? $_request is _post, then $$_request is $_post, similarly $_get $_key{0}! = ' _ ' && $$_key = xaddslashes ($_value);// $_key{0} What does this {0} mean? $_key{0}, curly braces should be the previous notation, can be understood as $_key[0]?} }
is to traverse $_get and $_post Super Global variables, and then check whether the first character of the key name is _, if not the key value after the Xaddslashes () function processing results assigned to the key name variable.
$_key{0} represents the first character to take $_key.