Skip to Content
PHPCODE
Object & Classes in php
oops code / August 11, 2018
<?php
class TV
{
public $model=’xyz’;
public $volume=1; function volumeUp()
{
$this->volume++;
}
function volumeDown()
{
$this->volume–;
}
}
$tv_one=new TV;
$tv_two=new TV;
$tv_one->volumeUP();
$tv_two->volumeUP();
$tv_one->volumeDown();echo $tv_two->volume;
echo $tv_one->model;

?>

PHPCODE © 2024