PHP static variable index and php static variable index. PHP static variable index, php static variable index directly on the code? Phpclassexample {publicstatic $ pa; public $ pb; publicfunction _ construct () {$ this-pb ++ self ::$ pa ;}}$ a PHP class static variable index, php static variable index
Directly add code
pb = ++self::$pa; }}$a = new example;$b = new example;echo $a->pb;echo '
';echo $b->pb;?>
Originally, the result should be
1-----------------------------------------------------1
But I am wrong. the correct result is
1----------------------------------------------------------------------------------2
I have not learned the basics well. make up for it now.
The http://www.bkjia.com/PHPjc/917483.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/917483.htmlTechArticlePHP class static variable index, php static variable index directly on the code? Phpclass example {public static $ pa; public $ pb; public function _ construct () {$ this-pb = ++ self ::$ pa ;}} $ a =...