Result Size: 625 x 571
x
 
<!DOCTYPE html>
<html>
<body>
<?php
class Fruit {
  // Properties
  var $name;
  var $color;
  // Methods
  function __construct($name, $color) {
    $this->name = $name;
    $this->color = $color; 
  }
  function __destruct() {
    echo "The fruit is {$this->name} and the color is {$this->color}."; 
  }
}
$apple = new Fruit("Apple", "red");
?>
 
</body>
<!-- Mirrored from www.w3schools.com/php/phptryit.asp?filename=tryphp_destructor2 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:50:49 GMT -->
</html>
×

Report a Problem: