System.getproperty notice:trying to get property of Non-object problemphp solution

Source: Internet
Author: User
I'm actually calling a Zend method of accessing the database, using the Fetchall method, but because there is no record in the database, the returned object is null, so I'll tell if the object is null:

Copy the Code code as follows:


if ($obj ==null) {
...
}


The result of this writing is that the above notice was produced, and it was strange that the object was null and could not be accessed.
After checking the data, it is found that the judgment is null and needs to be judged as follows:

Copy the Code code as follows:


if (Isset ($obj)) {
echo "This var was set set so I'll print.";
}


What does this isset do?
The Isset function is to detect whether a variable is set.
Format: bool Isset (mixed var [, mixed Var [, ...])
return value:
Returns FALSE if the variable does not exist
Returns FALSE if the variable exists and its value is null
Returns TURE if the variable exists and the value is not NULL
Returns TRUE if each item meets the previous requirement when checking multiple variables at the same time, otherwise the result is FALSE
If a variable has been freed with unset (), it will no longer be isset (). If you use Isset () to test a variable that is set to NULL, FALSE is returned. Also note that a null byte ("\0″") is not equivalent to PHP's null constant.
Warning: isset () can only be used for variables, because passing any other parameter will result in parsing errors. To detect if a constant is set, use the defined () function.
It seems that the problem with my judgment just now is that this "is a null byte (" \0″) is not equivalent to PHP's null constant ".

The above describes the System.getproperty notice:trying to get property of Non-object problemphp solution, Includes the content of System.getproperty, hope to be interested in PHP tutorial friends helpful.

  • 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.