check if object exists

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phishncode
Forum Newbie
Posts: 2
Joined: Sun Jul 25, 2004 3:36 pm

check if object exists

Post by phishncode »

Hi everyone I just started using objects and I am really digging them. The most recent version of php (or just my code) allows serialization with no problem so that makes my life much better. What I do not know how to do is check if a specific variable is an object or not. I ask to display an object on the screen but, I only want to display it if the object has been created. Does anyone know how this would be done.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

I believe [php_man]empty[/php_man]() works for both variables and objects.

Or even try [php_man]is_object[/php_man]().
Post Reply