|
Posted by Ryan Govostes on 07/13/07 16:11
Consider this cde:
/**********
class testClass {
var $value = 6;
}
function &getInstance() {
static $instance;
if(!isset($instance)) {
$instance = new testClass;
}
return $instance;
}
echo getInstance()->value;
/**********/
In PHP5, this correctly echos '6'. However, in PHP4, I get
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ','
or ';' in /test.php on line 16
I do need to the code in this format, without splitting it into two
lines (which I know works). It would be detrimental to my project if
it turns out this won't work at all :-\
Navigation:
[Reply to this message]
|