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

PS: Updating the documentation would require less effort. And I propose to
do so. I am already learning edit.php and PhD_PHP(
[fr]language/control-structures/match.xml anonymous#2137)


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
>

Reply via email to