22. METHODچیست؟ گرا شی نویسی برنامه در
<?php
class MyClass {
public $name = "John Doe";
public function setProperty($newval)
{ $this->name = $newval; }
public function getProperty()
{ return $this->name . "<br />"; }
}
$obj = new MyClass;
echo $obj->getProperty(); // Get the property value
$obj->setProperty(“Amir"); // Set a new one
echo $obj->getProperty(); // Read it out again to show the change
?>