How to indentify an object? ( Like hashcode() in java )

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
ZeroFear
Forum Newbie
Posts: 14
Joined: Tue Feb 14, 2006 10:47 pm

How to indentify an object? ( Like hashcode() in java )

Post by ZeroFear »

Is there something in PHP you can call on an object that will let you identifiy that specific object, like the default hashcode method in java?
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

you can print it:

Code: Select all

print($obj)
And it will print Object Id #12 or whatever, but this may not always be supported.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

why would you need that in PHP?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Weirdan wrote:why would you need that in PHP?
That's what I want to know.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

There are functions/classes here:

http://www.php.net/manual/en/ref.classobj.php

http://us2.php.net/manual/en/language.o ... ection.php (why don't the put this section in the main manual !?%#*&)
(#10850)
Post Reply