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
zachsilvey
Forum Newbie
Posts: 3 Joined: Sun Nov 11, 2007 12:01 pm
Location: Battle Ground, WA, USA
Post
by zachsilvey » Sat Mar 22, 2008 10:52 pm
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
Post
by zachsilvey » Sat Mar 22, 2008 11:02 pm
nevermind if forgot the () on the final getName function