A related issue with PHP references

Source: Internet
Author: User
A problem with PHP references
See this word on the Internet
If a reference is assigned to an undefined variable, a reference parameter is passed, or a reference is returned, the variable is created automatically. and point to NULL

Often use isset to determine whether a value exists, if the direct output of a non-existent value will be an error.

But if I use the quoted way, whether it can replace isset, whether it will impress the performance

$id =&$_get[' id ']


This $_get[' ID '] does not exist and will not be an error, there is a reference to the variable $id
------to solve the idea----------------------
$id =& $_get[' id '];
And
$id = @$_get[' id '];
is equivalent to the $id

But $id =& $_get[' id ']; After
Any modification to the $id will affect the $_get[' id '), which may cause problems with other parts of the program that use $_get[' ID ']

If you just want to avoid Notice level errors, you don't have to do this.

It is necessary to determine whether the incoming parameters are correct, especially the single entry system, which affects the entire workflow.
  • 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.