In my opinion this exception is invaluable for validating argumens- for example providing strict typing a la C:<?php
functiontripleInteguer($int)
{
if(!is_int($int))
throw newInvalidArgumentException('tripleIntegue function only accepts integuers. Imput was: '.$int);
return$int* 3;
}
$x= tripleInteguer(4); //$x == 12$x= tripleInteguer(2.5); //exception will be thrown as 2.5 is a float$x= tripleInteguer('foo'); //exception will be thrown as 'foo' is a string$x= tripleInteguer('4'); //exception will throw as '4' is also a string?>