static_properties_004.phpt 918 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Inherited static properties cannot be separated from their reference set.
  3. --FILE--
  4. <?php
  5. class C { public static $p = 'original'; }
  6. class D extends C { }
  7. class E extends D { }
  8. echo "\nInherited static properties refer to the same value across classes:\n";
  9. var_dump(C::$p, D::$p, E::$p);
  10. echo "\nChanging one changes all the others:\n";
  11. D::$p = 'changed.all';
  12. var_dump(C::$p, D::$p, E::$p);
  13. echo "\nReferences cannot be used to split the properties:\n";
  14. $ref = 'changed.one';
  15. D::$p =& $ref;
  16. var_dump(C::$p, D::$p, E::$p);
  17. ?>
  18. --EXPECT--
  19. Inherited static properties refer to the same value across classes:
  20. string(8) "original"
  21. string(8) "original"
  22. string(8) "original"
  23. Changing one changes all the others:
  24. string(11) "changed.all"
  25. string(11) "changed.all"
  26. string(11) "changed.all"
  27. References cannot be used to split the properties:
  28. string(11) "changed.one"
  29. string(11) "changed.one"
  30. string(11) "changed.one"