title: PHP - Declare function in class based on condition
body: <p>Is there a way to do something like this:</p>
  
  <pre><code>class Test {
      if(!empty($somevariable)) {
          public function somefunction() {
  
          }
      }
  }
  </code></pre>
  
  <p>I know this might not be best practice, but I need to do this for a very specific problem I have, so is there anyway to do it?  </p>
  
  <p>I just want that function to be included in the class if that variable (which is tied to a URL param) is not empty.  As it is written now, I get Error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION   </p>
  
  <p>Thanks!  </p>