You cant use $this
in a static function. Use self::
instead
webdestroya
2010-04-19 06:06:59
Make full_name
non-static:
public function full_name() {}
You cannot access instance variables from a static method but that is exactly what you are trying to do.
If you use self
instead of $this
, you have to declare $first_name
and $last_name
static as well.
I don't even understand why you declare this method as static
in the first place. It is an instance method by all means.
Check the last name of your index.php. echo->$object->full_name()
is not valid. Use echo $object->full_name()
instead.
Also, declare full_name()
as non-static.