Simple Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zachsilvey
Forum Newbie
Posts: 3
Joined: Sun Nov 11, 2007 12:01 pm
Location: Battle Ground, WA, USA

Simple Question

Post by zachsilvey »

I need a little help, I'm just learning the ways of object oriented programming. Can anyone tell me why won't this display "Bob".

Code: Select all

<?php
class Person{
    var $name = "Zach";
    function getName(){
        return $this->name;
    }
    function setName($newName){
        $this->name = $newName;
    }
}
$object = new Person;
$object->setName("Bob");
echo $object->getName;
?>
zachsilvey
Forum Newbie
Posts: 3
Joined: Sun Nov 11, 2007 12:01 pm
Location: Battle Ground, WA, USA

Re: Simple Question

Post by zachsilvey »

nevermind if forgot the () on the final getName function
Post Reply