title: Passing default parameters if not set
body: <p>I am trying to pass a variable if it hasn't been set. Here is the old method:</p>
  
  <pre><code>function CHECK_DATE($DATE, $FORMAT='Y-m-d', $var3) {
  CHECK_DATE(0000-00-00 00:00:00, '', '');
  </code></pre>
  
  <p>This is how I would have done it in procedural style. Therefore, if the second parameter is empty then it would fall back to 'Y-m-d'.</p>
  
  <p>I have the following (which doesn't work unless I remove all empty parameters):</p>
  
  <pre><code>class Date {
  public $date;
  public $format;
  
  public function setDate($date, $format='Y-m-d') {
      $this-&gt;date = date($format, strtotime($date));  
  }
  
  public function getDate() {
      return $this-&gt;date;
      echo 'test';        
  }
  }
  
      $getDate = new Date;
      $getDate-&gt;setDate('2013-08-31 13:05:18', '');   
      echo $getDate-&gt;getDate();
  </code></pre>