PHP object-oriented: this keyword

From , 3 Years ago, written in PHP, viewed 240 times.
URL https://pastebin.vip/view/133b3752
  1. <?
  2. class A{
  3.         private $a = 0;
  4.         public function __construct(){
  5.                 $this->a = $this->a + 1 ;
  6.         }
  7.        
  8.         public function doSomeThing(){
  9.                 $this->__construct();
  10.                 return $this->a;
  11.         }
  12.        
  13.        
  14. }
  15. $a = new A(); // 这里的$a 可不是类中的任何一个变量了.
  16. echo "现在 \$a 的值是" . $a->doSomeThing();
  17. ?>
  18.  

Reply to "PHP object-oriented: this keyword"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website