Verify an object was passed by reference.

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

Verify an object was passed by reference.

Post by ZeroFear »

Is there a way in PHP to verify an object was passed by reference and a copy of it was not made? In C++ you could use the addressof operator and check the memory address of the variable your about to pass to the method, and then once in the method call it again on the local method argument and check the two addresses to see if there the same.

anyone know how to do something like that in PHP??
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

function someFoo(&$someVar)
{
}
$someVar will always be a reference.
Post Reply