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!
<?PHP
class Lang
{
public $dir = 'ltr';
public function setDir($dir)
{
$this->dir = $dir;
}
public function getDir()
{
return $this->dir;
}
}
$language = new Lang();
$language->dir = 'rtl'; //The "language" object now has "rtl" as the value of it's property "dir"
echo $language->dir; //Echoes "rtl"
$language->setDir('ltr');
echo $language->getDir();//You can also use -> to access object methods
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.