Jump to content

$this


web_master

Recommended Posts

"$this ->" is used to get variables internal to that object your currently residing in. You'll also notice that when using variables contained within a class, you can't use the $ to reference them - But you have to use it to reference the object itself.

 

<?php

class Page {

  var $Title;

 

  function DisplayTitle( ) {

    echo "<TITLE>" . $this->Title . "</TITLE>\n";

  }

 

}

?>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/74709-this/#findComment-377678
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.