Plz anybody can help me why the below php code doesn’t work:
[php] <?php
class PrintName
{
var $name;
function show_name()
{
echo "\n";
echo "The name passed to this method is $name.", "\n";
echo "Hi $name! How are you doing?", "\n", "\n";
}
}
$obj1 = new PrintName;
$obj1 -> name = "George";
$obj1 -> show_name();
?>[/php]
The output would be but not showing :
The name passed to this method is George.
Hi George How are you doing?