This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP Classes/Objects

PHP - The $this Keyword

Apple

<?php
// define class Fruit
class Fruit {
  public $name;
  function set_name($name) {
    $this->name = $name;
  }
}
$apple = new Fruit();
$apple->set_name("Apple");

// display the object's name
echo $apple->name;
?>