Annotation of embedaddon/php/tests/classes/static_properties_004.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Inherited static properties can 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: 
                      9: echo "\nInherited static properties refer to the same value accross classes:\n";
                     10: var_dump(C::$p, D::$p, E::$p);
                     11: 
                     12: echo "\nChanging one changes all the others:\n";
                     13: D::$p = 'changed.all';
                     14: var_dump(C::$p, D::$p, E::$p);
                     15: 
                     16: echo "\nBut because this is implemented using PHP references, the reference set can easily be split:\n";
                     17: $ref = 'changed.one';
                     18: D::$p =& $ref;
                     19: var_dump(C::$p, D::$p, E::$p);
                     20: ?>
                     21: ==Done==
                     22: --EXPECTF--
                     23: Inherited static properties refer to the same value accross classes:
                     24: %unicode|string%(8) "original"
                     25: %unicode|string%(8) "original"
                     26: %unicode|string%(8) "original"
                     27: 
                     28: Changing one changes all the others:
                     29: %unicode|string%(11) "changed.all"
                     30: %unicode|string%(11) "changed.all"
                     31: %unicode|string%(11) "changed.all"
                     32: 
                     33: But because this is implemented using PHP references, the reference set can easily be split:
                     34: %unicode|string%(11) "changed.all"
                     35: %unicode|string%(11) "changed.one"
                     36: %unicode|string%(11) "changed.all"
                     37: ==Done==

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>