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