You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
335 B

3 years ago
  1. <?php
  2. class father
  3. {
  4. public $var_a = 1;
  5. public function fn_a()
  6. {
  7. var_dump($this);
  8. }
  9. }
  10. class Son extends father
  11. {
  12. public $var_b = 2;
  13. public function fn_b()
  14. {
  15. // var_dump($this);
  16. var_dump(array_keys(get_object_vars($this)));
  17. }
  18. }
  19. $son = new Son();
  20. $son->fn_b();
  21. // $son->fn_a();