View Single Post
Old 07-18-2008, 11:53 PM   #7 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

You can use exceptions, which boiled down would look something like;

PHP Code:
try
{
    
userFunc($arg);
}
catch (
$e Exception)
{
    die(
$e->getMessage());
}

function 
userFunc ($arg)
{
    if (
$arg != $met)
        throw new 
exception('Condition not met');

Alternatively you can throw the exception from within the try{} block, it just needs to be thrown from somewhere within the try to be caught. There's also trigger_error() to throw your own errors (preferably in conjunction with a custom error handler).
-m
delayedinsanity is offline  
Reply With Quote
The Following User Says Thank You to delayedinsanity For This Useful Post:
ETbyrne (07-19-2008)