hehexu

博客园 首页 新随笔 联系 订阅 管理
    1. <?php  
    2. error_reporting(-1);  
    3. ini_set('display_errors','on');  
    4.   
    5. class A {   
    6.     public $a = 'hello';  
    7.   
    8.     public function add() {  
    9.         $this->b = 'world';  
    10.     }-    
    11.     public static function p() {  
    12.         echo 'world',PHP_EOL;  
    13.     }-    
    14. }  
    15.   
    16. $a = new A;  
    17. $a->add();  
    18. $a->c = 'test';  
    19. $a->p();  
    20.   
    21. var_dump($a); 
      1. world  
      2. object(A)#1 (3) {  
      3.   ["a"]=>  
      4.   string(5) "hello"  
      5.   ["b"]=>  
      6.   string(5) "world"  
      7.   ["c"]=>  
      8.   string(4) "test"  

       

       

posted on 2017-11-12 17:43  hehexu  阅读(383)  评论(0编辑  收藏  举报