I am trying to create a very basic object but am having troubles.
<?php
class item{
public $name;
public $price;
function __construct($name,$price){
$this->name=$name;
$this->price=$price;}
function getName(){
return $this->name;
}
}
$object = new item("car",400);
echo $object->getName();
?>
The HTML output is:
name=$name; $this->price=$price;} function getName(){ return $this->name; } } $object = new item("car",400); echo $object->getName(); ?>
I'm sure that this code is clean but for some reason will not output the desired result! any help would be great. thanks.