<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://wbex.ru/index.php?action=history&amp;feed=atom&amp;title=PHP%2FClass%2Fthis</id>
		<title>PHP/Class/this - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://wbex.ru/index.php?action=history&amp;feed=atom&amp;title=PHP%2FClass%2Fthis"/>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Class/this&amp;action=history"/>
		<updated>2026-04-05T02:43:37Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://wbex.ru/index.php?title=PHP/Class/this&amp;diff=88&amp;oldid=prev</id>
		<title> в 10:37, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Class/this&amp;diff=88&amp;oldid=prev"/>
				<updated>2010-05-26T10:37:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 10:37, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://wbex.ru/index.php?title=PHP/Class/this&amp;diff=89&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Class/this&amp;diff=89&amp;oldid=prev"/>
				<updated>2010-05-26T07:00:48Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Accessing the $age variable using this-&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
class Cat {&lt;br /&gt;
    var $age;&lt;br /&gt;
    function Cat($new_age){&lt;br /&gt;
        $this-&amp;gt;age = $new_age;&lt;br /&gt;
    }&lt;br /&gt;
    function Birthday(  ){&lt;br /&gt;
        $this-&amp;gt;age++;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
$fluffy = new Cat(1);&lt;br /&gt;
echo &amp;quot;Age is $fluffy-&amp;gt;age &amp;lt;br /&amp;gt;&amp;quot;;&lt;br /&gt;
echo &amp;quot;Birthday&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
$fluffy-&amp;gt;Birthday(  );&lt;br /&gt;
echo &amp;quot;Age is $fluffy-&amp;gt;age &amp;lt;br /&amp;gt;&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==$this keyword refers to the instance from within the class definition==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  class Bird&lt;br /&gt;
  {&lt;br /&gt;
    function __construct($name, $breed)&lt;br /&gt;
    {&lt;br /&gt;
      $this-&amp;gt;name = $name;&lt;br /&gt;
      $this-&amp;gt;breed = $breed;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  $tweety = new Bird(&amp;quot;Tweety&amp;quot;, &amp;quot;canary&amp;quot;);&lt;br /&gt;
  printf(&amp;quot;&amp;lt;p&amp;gt;%s is a %s.&amp;lt;/p&amp;gt;\n&amp;quot;, $tweety-&amp;gt;name, $tweety-&amp;gt;breed);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Use this keyword==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
   class Staff&lt;br /&gt;
   {&lt;br /&gt;
      var $name;&lt;br /&gt;
      var $city;&lt;br /&gt;
      protected $wage;&lt;br /&gt;
      function __get($propName)&lt;br /&gt;
      {&lt;br /&gt;
         echo &amp;quot;__get called!&amp;lt;br /&amp;gt;&amp;quot;;&lt;br /&gt;
         $vars = array(&amp;quot;name&amp;quot;,&amp;quot;city&amp;quot;);&lt;br /&gt;
         if (in_array($propName, $vars))&lt;br /&gt;
         {&lt;br /&gt;
            return $this-&amp;gt;$propName;&lt;br /&gt;
         } else {&lt;br /&gt;
            return &amp;quot;No such variable!&amp;quot;;&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
   $employee = new Staff();&lt;br /&gt;
   $employee-&amp;gt;name = &amp;quot;Joe&amp;quot;;&lt;br /&gt;
   echo $employee-&amp;gt;name.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
   echo $employee-&amp;gt;age;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Use this keyword to reference interal properties==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
class Employee {&lt;br /&gt;
    public $numPages;&lt;br /&gt;
    public $stayYear;&lt;br /&gt;
    public $title;&lt;br /&gt;
    public $lastName;&lt;br /&gt;
    public $firstName;&lt;br /&gt;
    public $price;&lt;br /&gt;
    &lt;br /&gt;
    function __construct(   $title, $firstName, &lt;br /&gt;
                            $mainName, $price, &lt;br /&gt;
                            $numPages=0, $stayYear=0 ) { &lt;br /&gt;
        $this-&amp;gt;title             = $title;&lt;br /&gt;
        $this-&amp;gt;firstName = $firstName;&lt;br /&gt;
        $this-&amp;gt;lastName  = $mainName;&lt;br /&gt;
        $this-&amp;gt;price     = $price;&lt;br /&gt;
        $this-&amp;gt;numPages  = $numPages;&lt;br /&gt;
        $this-&amp;gt;stayYear = $stayYear;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    function getNumberOfPages() {&lt;br /&gt;
        return $this-&amp;gt;numPages;&lt;br /&gt;
    }&lt;br /&gt;
    function getStayLength() {&lt;br /&gt;
        return $this-&amp;gt;stayYear;&lt;br /&gt;
    }&lt;br /&gt;
    function getFullName() {&lt;br /&gt;
        return &amp;quot;{$this-&amp;gt;firstName}&amp;quot; .  &amp;quot;{$this-&amp;gt;lastName}&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
$product1 = new Employee(&amp;quot;A&amp;quot;, &amp;quot;A1&amp;quot;, &amp;quot;A2&amp;quot;, 5.99, 300 );&lt;br /&gt;
$product2 = new Employee(&amp;quot;B&amp;quot;, &amp;quot;B1&amp;quot;, &amp;quot;B2&amp;quot;, 10.99, null, 60.33 );&lt;br /&gt;
print &amp;quot;author:          &amp;quot;.$product1-&amp;gt;getFullName().&amp;quot;\n&amp;quot;;&lt;br /&gt;
print &amp;quot;number of pages: &amp;quot;.$product1-&amp;gt;getNumberOfPages().&amp;quot;\n&amp;quot;;&lt;br /&gt;
print &amp;quot;artist:          &amp;quot;.$product2-&amp;gt;getFullName().&amp;quot;\n&amp;quot;;&lt;br /&gt;
print &amp;quot;play length:     &amp;quot;.$product2-&amp;gt;getStayLength().&amp;quot;\n&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>