jeudi 2 août 2018

Does empty() utilize isset() in PHP?

Under the Notes section of http://php.net/manual/en/function.empty.php

It states...

Note:

When using empty() on inaccessible object properties, the __isset() overloading method will be called, if declared.

Does that mean:

if( empty( $_REQUEST['data'] ) ){
    return false;
}

is the same as:

if( !isset( $_REQUEST['data'] ) || isset( $_REQUEST['data'] ) && !$_REQUEST['data'] ){
    return false;
}

Are the above two statements treated the same?

Aucun commentaire:

Enregistrer un commentaire