Skip to content
Advertisement

__set() and __get() not work with isset() and empty(). How solve?

having:

JavaScript

Doing:

JavaScript

Why return "myproperty not setted"? Same problem if i replace isset with empty. Is a bug? If no, how i can fix it?

Advertisement

Answer

You should use the __isset() method. Here is an example:

JavaScript

Note that this way empty() will work too because internally it uses __isset().

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement