Alan Knowles wrote:

I think he's referening to something like this (which is common in pear):

$x = $someobj->somemethod();
if ($x instanceOf PEAR_Error) {
  .......
}

while that code is redundant in the case of exceptions, it is still a valid situation.. that $x may be a valid return, and PEAR_Error was never loaded..


Yup, that's exactly what I'm talking about.

I want to be able to do this:

if ($db instanceof DBPostgres) {
  /// do something funky specific to Postgres
}

If My DB adapter is DBMySQL, I don't want to load the DBPostgres adapter just so I can test whether my object is of that type ...

and checking first whether class_exists('DBPostgres') just seems kinda kludgy & straying from the "problem domain" ... especially since $db instanceof DBPostgres would *always* be false if DBPostgres isn't loaded.

Hans

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to