Determining if object property is empty
<p>I feel like I'm missing something here. I've been using PHP's empty() function for quite a while now in determining if a variable is empty. I wanted to use it to determine if an object's property is empty, but somehow it doesn't work. Here's a simplified class to illustrate the problem</p>

<pre><code>    // The Class 
    class Person{
        private $number;

        public function __construct($num){
            $this-&gt;number = $num;
        }

        // this the returns value, even though its a private member
        public function __get($property){
            return intval($this-&gt;$property);
        }
    }

    // The Code    
    $person = new Person(5);

    if (empty($person-&gt;number)){
        echo "its empty";
    } else {
        echo "its not empty";
    }
</code></pre>

<p>So basically, the $person object should have a value (5) in its number property. As you might have guessed, the problem is that php echoes "its empty". But it's not!!!</p>

<p>However, it does work if I store the property in a variable, then evaluate it. </p>

<p>So what would be the best way to determine if an object property is empty? Thank you.</p>
