Accessing a Property from Within a Method : Class Property « Class « PHP
- PHP
- Class
- Class Property
Accessing a Property from Within a Method
<?php
class Item {
var $name = "item";
function getName () {
return $this->name;
}
}
$item = new Item ();
$item->name = "widget 5442";
print $item->getName ();
?>
Related examples in the same category