Re: is_a() calls in PEAR.php
| From: | Thorsten Suckow-Homberg | Date: | Fri, 07 May 2004 10:06:10 +0000 |
| Subject: | Re: is_a() calls in PEAR.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-28937@lists.php.net to get a copy of this message | ||
Hi Michael,
this checks - as you may have read in the fnction reference - if the first
parameter is a class/ subclass of the given second parameter.
AFAIK is the main intention of this in the PEAR-project to check the
type/class of return values from methods. It makes checking for errors that
may have been returned easier.
Example:
======
function returnFoo($abc)
{
if (is_int($abc)) {
return true;
}
return PEAR::raiseError(...);
}
$mRet = returnFoo("r");
if (is_a($mRet, "PEAR_Error")) {
// work on the error-object, gather information and so on
}
hth
Thorsten