$p = $p = = "? "1": $p; what's wrong with defining variables?

Source: Internet
Author: User
Why I run in the company is no problem, copy to my Computer, because my &p used as a page value, so I each function in $p first error.


Reply to discussion (solution)

Please ask the landlord p = $p = = "? "1": $p; Do you think this is a ternary operation?

$p = $p = = "? "1": $p;
There will be notice:undefined variable:p error warning
The reason is that you are not blocking E_notice level errors, that is to say: Your program is not robust

The loosely written wording is
$p = @ $p = = "? "1": $p;
The strict wording is
$p =! Isset ($p) | | $p = = "? "1": $p;

PHP7 can write
$p = $p?? "1";

Thank you 2L. Not so happy. $p solved the problem.
But there are a lot of notice:undefined problems. It turns out that the difference between computers is so big.

Program in error_reporting (e_all ^ e_notice);
PHP.ini in error_reporting = e_all ^ E_notice
After that, notice:undefined is gone.

  • Related Article

    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.