title: Variable type validation
body: <p>I have methods which parameters can only handle certain types of variable. I have a few ideas on how to validate these type and I need your help to choose the best way.<br>
  I could:</p>
  
  <ul>
  <li>Just return <code>false</code> if one of the types of variable is wrong, without letting the user know what's happening. Plus, if the function's output isn't usually checked by the user--e.g. <code>ob_start()</code>--they won't know it's even wrong;</li>
  <li>Throw a custom <a href="http://php.net/manual/en/class.invalidargumentexception.php" rel="nofollow"><code>InvalidArgumentException</code></a> saying "Type of parameter X is incorrect." Thus I have to check every single parameter, making the code unreadable. Plus, the exception actually has to be catched, and I dislike these <code>try...catch</code> in my code.</li>
  <li>Call <code>error_log()</code>. But yet I have to check every single parameter.</li>
  </ul>
  
  <p>What option would you choose? Why? Otherwise, do you have a better idea?</p>
  
  <hr>
  
  <p><strong>UPDATE</strong><br>
  When I talk about types, I mean these:
  <a href="http://php.net/manual/en/language.types.php" rel="nofollow">http://php.net/manual/en/language.types.php</a></p>