009.phpt 842 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. get_class() tests
  3. --FILE--
  4. <?php
  5. class foo {
  6. function bar () {
  7. var_dump(get_class());
  8. }
  9. }
  10. class foo2 extends foo {
  11. }
  12. foo::bar();
  13. foo2::bar();
  14. $f1 = new foo;
  15. $f2 = new foo2;
  16. $f1->bar();
  17. $f2->bar();
  18. var_dump(get_class());
  19. var_dump(get_class("qwerty"));
  20. var_dump(get_class($f1));
  21. var_dump(get_class($f2));
  22. echo "Done\n";
  23. ?>
  24. --EXPECTF--
  25. Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d
  26. string(3) "foo"
  27. Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d
  28. string(3) "foo"
  29. string(3) "foo"
  30. string(3) "foo"
  31. Warning: get_class() called without object from outside a class in %s on line %d
  32. bool(false)
  33. Warning: get_class() expects parameter 1 to be object, string given in %s on line %d
  34. bool(false)
  35. string(3) "foo"
  36. string(4) "foo2"
  37. Done