I think it's confusing. PHPcode & lt ;? PhpclasscA {/*** testpropertyforusingdirectdefavalue value */protectedstatic $ ite I am confused
PHP code
* Foo * cB * Tango * cC * Foo * cD * * What the hell?! :) */?>
Is this overwriting, or what? Why is the output so incomprehensible? it sounds messy.
------ Solution --------------------
What is this? Looking for trouble!
Tired
------ Solution --------------------
It doesn't matter if you don't understand it.
------ Solution --------------------
Discussion
What is this? Make dumplings for trouble!
Tired
------ Solution --------------------
This may make it clearer.
PHP code
Class cA {/*** Test property for using direct default value * use the direct default value to Test the property */protected static $ item = 'foo '; /*** Test property for using indirect default value * use indirect default value to Test the property */protected static $ other = 'CA'; public static function method () {print _ METHOD __. ''. _ CLASS __. ': $ item = '. self: $ item. "\ r \ n"; print _ METHOD __. ''. _ CLASS __. ': $ otfer = '. self: $ other. "\ r \ n";} public stat Ic function setOther ($ val) {self: $ other = $ val; // Set a value in this scope .}} class cB extends cA {/*** Test property with redefined default value * Redefining the default Test property */protected static $ item = 'bar '; public static function setOther ($ val) {self: $ other = $ val ;}} class cC extends cA {/*** Test property with redefined default value * Redefining the default Test property */protected static $ item = 'tnang'; public static Function method () {print _ METHOD __. ''. _ CLASS __. ': $ item = '. self: $ item. "\ r \ n"; print _ METHOD __. ''. _ CLASS __. ': $ otfer = '. self: $ other. "\ r \ n";}/*** Now we drop redeclaring the setOther () method, use cA with 'self: 'Just for fun. */} class cD extends cA {/*** Test property with redefined default value * Redefining the default Test property */protected static $ item = 'Foxtrot '; /*** Now we drop re Declaring all methods to complete this issue. * Now, let's discard all the methods that are re-declared to solve this problem */} cB: setOther ('cb '); // It's cB: method ()! CB: method (); // It's cA: method ()! CC: setOther ('CC'); // It's cA: method ()! CC: method (); // It's cC: method ()! CD: setOther ('CD'); // It's cA: method ()! CD: method (); // It's cA: method ()!