Why does the constructor not change the name of the variable? It tells me $name is not defined.
<?php
class Person{
public $name;
public function __construct($var){
$this->name = $var;
}
public function greet(){
echo "Hello, my name is ".$name.", nice to meet you :-)";
}
}
$me = new Person("Bob");
$me->greet();
?>
Thanks in advance :-)
Stephen,