note 93234 added to language.pseudo-types

From: Date: Sat, 29 Aug 2009 16:20:46 +0000
Subject: note 93234 added to language.pseudo-types
Groups: php.notes 
Request: Send a blank email to php-notes+get-160026@lists.php.net to get a copy of this message
The documentation is a little confusing, and with the recent OO changes it adds a little more to the confusion. I was curious whether you could pass an object through the user func, modify it in that callback and have the actual object updated or whether some cloning was going on behind the scenes. <?php class Test { var $sValue = 'abc'; function testing($objTest) { $objTest->sValue = '123'; } } $obj = new Test(); call_user_func(array($obj, 'testing'), $obj); var_dump($obj); ?> This works as expected: The object is not cloned, and $sValue is properly set to '123'. With the OO changes in PHP 5, you don't need to do "function testing(&$objTest)" as it is already passed by reference. ---- Server IP: 208.69.120.35 Probable Submitter: 98.237.141.133 ---- Manual Page -- http://www.php.net/manual/en/language.pseudo-types.php Edit -- https://master.php.net/note/edit/93234 Del: integrated -- https://master.php.net/note/delete/93234/integrated Del: useless -- https://master.php.net/note/delete/93234/useless Del: bad code -- https://master.php.net/note/delete/93234/bad+code Del: spam -- https://master.php.net/note/delete/93234/spam Del: non-english -- https://master.php.net/note/delete/93234/non-english Del: in docs -- https://master.php.net/note/delete/93234/in+docs Del: other reasons-- https://master.php.net/note/delete/93234 Reject -- https://master.php.net/note/reject/93234 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160026) next »