You are here: unexpected T_STRING, expecting T_VARIABLE « PHP Language « IT news, forums, messages
unexpected T_STRING, expecting T_VARIABLE

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация