For a php foreach question, please expert guidance

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.