get_class_vars_002.phpt 683 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. get_class_vars(): Testing the scope
  3. --FILE--
  4. <?php
  5. class A {
  6. public $a = 1;
  7. private $b = 2;
  8. private $c = 3;
  9. }
  10. class B extends A {
  11. static public $aa = 4;
  12. static private $bb = 5;
  13. static protected $cc = 6;
  14. }
  15. class C extends B {
  16. public function __construct() {
  17. var_dump(get_class_vars('A'));
  18. var_dump(get_class_vars('B'));
  19. var_dump($this->a, $this->b, $this->c);
  20. }
  21. }
  22. new C;
  23. ?>
  24. --EXPECTF--
  25. array(1) {
  26. ["a"]=>
  27. int(1)
  28. }
  29. array(3) {
  30. ["a"]=>
  31. int(1)
  32. ["aa"]=>
  33. int(4)
  34. ["cc"]=>
  35. int(6)
  36. }
  37. Warning: Undefined property: C::$b in %s on line %d
  38. Warning: Undefined property: C::$c in %s on line %d
  39. int(1)
  40. NULL
  41. NULL