Reply to Object of class Person could not be converted to string

Your name:

Reply:


Posted by phpCodeHead on 06/11/07 04:46

Code which should allow my constructor to accept arguments:

<?php
class Person {
function __construct($name)
{
$this->name = $name;
}

function getName()
{
return $this->name;
}

function printName()
{
print $this->name;
}

private $name;
}

$judy = new Person("Judy") . "\n"; // <- this is line parser don't
like
$joe = new Person("Joe") . "\n";

$judy->printName() . '<br />';
$joe->printName() . '<br />';
?>

Outputs:

Catchable fatal error: Object of class Person could not be converted
to string

Anyone seen this before? Know why? Am I missing something here?

Thanks all...

Gene Kelley
LAMP Web Developer
bizFlowDesigns.com

[Back to original 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

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