lsb_014.phpt 412 B

123456789101112131415161718192021222324
  1. --TEST--
  2. ZE2 Late Static Binding access to static::const through defined() and get_constant()
  3. --FILE--
  4. <?php
  5. class Test1 {
  6. static function test() {
  7. var_dump(defined("static::ok"));
  8. if (defined("static::ok")) {
  9. echo constant("static::ok");
  10. }
  11. }
  12. }
  13. class Test2 extends Test1 {
  14. const ok = "ok";
  15. }
  16. Test1::test();
  17. Test2::test();
  18. ?>
  19. --EXPECT--
  20. bool(false)
  21. bool(true)
  22. ok