Page 1 of 1

SOLVED! Detect class isset while !triggering nonobject error

Posted: Mon Mar 10, 2008 1:52 pm
by JAB Creations
I'm trying to merely detect is a class isset and if it's not to include a file...

Code: Select all

if (
!isset(
$error->get('query')
)) {include("includes.php");}
However on every other page where the class !isset I get the following error message...
Call to a member function get() on a non-object
I thought that was the point of determining if it's set or not?! :roll:

Re: Detect class isset while !triggering non-object error?

Posted: Mon Mar 10, 2008 1:56 pm
by alex.barylski
get_declared_classes()

Re: Detect class isset while !triggering non-object error?

Posted: Mon Mar 10, 2008 2:00 pm
by JAB Creations
Thanks! Thank goodness for see also on php.net! :mrgreen:

Code: Select all

if (!class_exists('error')) {include("includes.php");}

Re: Detect class isset while !triggering non-object error?

Posted: Mon Mar 10, 2008 2:09 pm
by alex.barylski
Thats the one. :)