1--TEST-- 2get_class_vars(): Testing the scope 3--FILE-- 4<?php 5 6class A { 7 public $a = 1; 8 static public $A = 2; 9 10 private $b = 3; 11 static private $B = 4; 12 13 protected $c = 5; 14 static protected $C = 6; 15 16 public function __construct() { 17 var_dump(get_class_vars('A')); 18 } 19 20 static public function test() { 21 var_dump(get_class_vars('A')); 22 } 23} 24 25var_dump(get_class_vars('A')); 26 27new A; 28 29var_dump(A::test()); 30 31?> 32--EXPECT-- 33array(2) { 34 ["a"]=> 35 int(1) 36 ["A"]=> 37 int(2) 38} 39array(6) { 40 ["a"]=> 41 int(1) 42 ["b"]=> 43 int(3) 44 ["c"]=> 45 int(5) 46 ["A"]=> 47 int(2) 48 ["B"]=> 49 int(4) 50 ["C"]=> 51 int(6) 52} 53array(6) { 54 ["a"]=> 55 int(1) 56 ["b"]=> 57 int(3) 58 ["c"]=> 59 int(5) 60 ["A"]=> 61 int(2) 62 ["B"]=> 63 int(4) 64 ["C"]=> 65 int(6) 66} 67NULL 68