$This Keyword Refers To The Instance From Within The Class Definition

<?php
  class Bird
  {
    function __construct($name, $breed)
    {
      $this->name = $name;
      $this->breed = $breed;
    }
  }  $tweety = new Bird('Tweety', 'canary');  printf("<p>%s is a %s.</p>\n", $tweety->name, $tweety->breed);
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.