I am getting fatal error-
Catchable fatal error: Object of class TV could not be converted to string in /opt/lampp/htdocs/projects/oop/index.php on line 31.
What is is wrong here?
<?php
/**
*
*/
class TV {
public $model= 'xyz';
public $volume= 1;
function volumeUp()
{
$this->volume++;
}
function volumeDown()
{
$this->volume--;
}
}
//here we create new objects
$tv_one = new TV;
$tv_two = new TV;
//
$tv_one->volumeUp();
echo $tv_one->volume;
$tv_one->model;
//error on the following line
echo $tv_one;