<html>
<body>
class Fruit {
public $name;
function set_name($name) {
$this->name = $name;
}
}
$apple = new Fruit();
$apple->set_name("Apple");
echo $apple->name;
</body>
<!-- Mirrored from www.w3schools.com/php/phptryit.asp?filename=tryphp_this by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 16:49:39 GMT -->
</html>