On Thu, Feb 25, 2021 at 4:46 PM Glash Gnome <glash.gn...@gmail.com> wrote:
> Dears, > > Let me briefly introduce myself. I have been a C coder for 19 years, > including 12 years with php. And I also do Java, C++, Javascript... from > time to time. > > Nikita, What would the equivalent of this code be after RFC modification? > > <?php > > class CXPLeaks > { > static function refCount() { > static $i=0; > $i++; > } > function refCountByClass() { > static $i=0; > $i++; > } > function __construct() { > self::refCount(); > self::refCountByClass(); > } > } > > > Declaring a static variable in a class or in a function, in terms of > speed/work it's the same. > For me, this is not a bug. It's a misunderstanding > For me, who codes in C, the current behavior is intuitive. > For me, there is no language as agile as PHP. > > Best regards, > Serge > Your example does not contain inheritance, so the RFC has no impact on it. As such, I do not understand your question. Nikita > Le mar. 23 févr. 2021 à 15:02, Nikita Popov <nikita....@gmail.com> a > écrit : > >> Hi internals, >> >> While looking into various issues related to static variable handling, >> I've >> become increasingly convinced that our handling of static variables in >> inherited methods is outright buggy. However, it's also long-standing >> behavior, so I've put up an RFC: >> >> https://wiki.php.net/rfc/static_variable_inheritance >> >> Regards, >> Nikita >> >