title: Functions that can take parameters via the URL or POST
body: <p>I have come across a scenario where sometimes I will need to pass parameters to a function via post e.g. an ajax call for real time data, and the default style of passing a parameter i.e. <code>myFunc($param)</code>.</p>
  
  <p>I have started to do this the following way:</p>
  
  <pre><code>public function createNote($note = null)
    {
      if($note == null) // If param didn't come in by a call or url...
      {
        $note = $_POST['note']; // Use the post data.
      }
      // Do stuff with $note...
    }
  </code></pre>
  
  <p>Is there anything wrong with what I am doing or is this the best way?</p>