|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesnull (last revision 2016-04-07 07:24 UTC by 1783946138 at qq dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-04-07 12:07 UTC] requinix@php.net
-Status: Open
+Status: Wont fix
-Package: PHP Language Specification
+Package: Scripting Engine problem
[2016-04-07 12:07 UTC] requinix@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 05:00:01 2025 UTC |
Description: ------------ I think the non-static method of class should be have independence in different object of this class. For example,The static variable what is in the non-static method of class should not be shared in different object. Test script: --------------- class Test { public function print_index() { static $index=0;//the static* return $index++; } } $obj1=new Test; $obj2=new Test; //I think there should be echo $obj1->print_index().PHP_EOL;//result:0 0 echo $obj2->print_index().PHP_EOL;//result:1 0 echo $obj1->print_index().PHP_EOL;//result:2 1 echo $obj2->print_index().PHP_EOL;//result:3 1 Expected result: ---------------- 0 0 1 1 Actual result: -------------- 0 1 2 3