Re: object as function argument

From: Date: Tue, 11 Oct 2005 23:00:35 +0000
Subject: Re: object as function argument
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-223938@lists.php.net to get a copy of this message
Björn Bartels wrote:
myab ths a stupid question, but i didn't find anything inside the php docs: is it possibe to pass an object (like $foo = new myObject(); ) to a function as its argument (like my_func($foo); )
Yes, but if you're using PHP 4 you may want to define the function as taking that argument by reference (&$foo) unless you want to pass a copy of the object. It would have taken you less time to write a test script and see for yourself than to search the docs and then post to the list... -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/

« previous php.general (#223938) next »