Hi there,
I'm learning from PHP5 Power Programming by Gutmans, Bakken & Rethans and have come to p.58. The book says the output is:
Judy
Joe
However I get nothing from neither IE8 nor FF3 instead!
My machine is XP + PHP5 + Apache2.2. The error message is:
Catchable fatal error: Object of class Person could not be converted to string in C:\Program Files\...\PHP5 PP\58.php on line 24
Any clue?
Thanks in advance,
-hide2may
// Here is the source:
I'm learning from PHP5 Power Programming by Gutmans, Bakken & Rethans and have come to p.58. The book says the output is:
Judy
Joe
However I get nothing from neither IE8 nor FF3 instead!
My machine is XP + PHP5 + Apache2.2. The error message is:
Catchable fatal error: Object of class Person could not be converted to string in C:\Program Files\...\PHP5 PP\58.php on line 24
Any clue?
Thanks in advance,
-hide2may
// Here is the source:
Code:
<html> <title>PHP5 Power Programming</title> <head>P.58</head> <body> <?php error_reporting(E_ALL); ini_set('display_errors', true); class Person { function _construct($name) { $this->name = $name; } function getName() { return $this->name; } private $name; }; $judy = new Person("Judy") . "\n"; // <---- this is line 24 $joe = new Person("Joe") . "\n"; print $judy->getName(); print $joe->getName(); ?> </body> </html>
Comment