title: php null object vs default null values
body: <p>I just read a great article about the Null Object Pattern (<a href="http://phpmaster.com/the-null-object-pattern-polymorphism-in-domain-models/" rel="nofollow">http://phpmaster.com/the-null-object-pattern-polymorphism-in-domain-models/</a>) and I'm planning on implementing it into some existing code.</p>
  
  <p>my question is would a whole new 'null class' be the best way about doing this? Previously I had set default values in the constructor as NULL. Then I could just create empty shells of the class. For example:</p>
  
  <pre><code>class person{
  
      private $_personId;
      private $_name;
      private $_email;
      private $_phone;
  
      public function __construct($_personId, $_name, $_email, $_phone = NULL){
          //set the vars here
      }
  
  }
  </code></pre>
  
  <p>Then if I wanted a real object I would do:</p>
  
  <pre><code>$person = new person(1, 'John Doe', 'doe@gmail.com');
  </code></pre>
  
  <p>And if I wanted a 'null' object i would do:</p>
  
  <pre><code>$person = new person(NULL, NULL, NULL);
  </code></pre>
  
  <p>Are there any pitfalls to this approach?</p>