|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-15 05:53 UTC] daniel at webdevelopers dot cz
There is the line marked with '#*' in the following script. One line up you will find other line that should make the exactly same action (I think). Try to comment this line and uncomment line with '#*'. The output will differ. Why?
--- SCRIPT: START ---
<PRE><?php
class test {
function test() {
extfunc($this);
}
}
#___________________________________________________________
function extfunc(&$ref) {
global $obj;
$GLOBALS["obj"]=&$ref; # This is the same as '$obj=&$ref;'. Isn't it?
#* $obj=&$ref;
}
#===========================================================
$test=new test();
var_dump($obj);
?></PRE>
--- SCRIPT: END ---
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 20:00:01 2025 UTC |
This error is reproducable for PHP 4.2.0rc1: First version ($GLOBALS["obj"]=&$ref;) gives: object(test)(0) { } Second version ($obj=&$ref;) gives: NULL