|
Posted by Jeff on 07/30/07 21:17
PHP 5.2.3
When I execute this code I get an "unexpected T_STRING, expecting
T_VARIABLE" error .. on line 13, which is this line : public test()
If I comment out this test method and execute this script then only
****************************************** is displayed. I thought it at
least should display the "constructing A" and "constructing B"
any suggestions?
below is the problem code:
************* the code ************
<?php
class A
{
public $name;
public function __constructor()
{
echo "constructing A";
$this->$name = "helloworld";
}
public test()
{
return 4;
}
public function __get($name)
{
return $name;
}
}
class B extends A
{
public function __constructor()
{
parent::__constructor();
echo "constructing B";
}
}
echo "******************************************";
$noob = new B();
echo $noob->test();
?>
Navigation:
[Reply to this message]
|