I need to know about magic function __isset()
and normal function isset()
. Actually what is the real difference between php language construct
Magic functions are automatically invoked (triggered) when something happens. Normal functions have to be specifically invoked by your php code.
In your case: __isset() will be automatically invoked when you have an isset() which is trying to get a non-accessible property.
Example:
root@folgore:/tmp/php# cat a.php
att1);
// __isset will not be triggered:
isset($obj->att2);
root@folgore:/tmp/php# php a.php
__isset invoked for att1