3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class User { public const STATUS_ACTIVE = 'active'; public const STATUS_INACTIVE = 'inactive'; public static $nombreUtilisateursInitialisés = 0; public function __construct(public string $username, public string $status = self::STATUS_ACTIVE) { } } class Admin extends User { public static $nombreAdminInitialisés = 0; public static function nouvelleInitialisation() { self::$nombreAdminInitialisés++; parent::$nombreUtilisateursInitialisés++; } } Admin::nouvelleInitialisation(); var_dump(Admin::$nombreAdminInitialisés, Admin::$nombreUtilisateursInitialisés, User::$nombreUtilisateursInitialisés); var_dump(User::$nombreAdminInitialisés); // ceci ne marche pas.
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g4tlE
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   INIT_STATIC_METHOD_CALL                                  'Admin', 'nouvelleInitialisation'
          1        DO_FCALL                                      0          
   31     2        INIT_FCALL                                               'var_dump'
          3        FETCH_STATIC_PROP_R          unknown             ~1      'nombreAdminInitialis%C3%A9s'
          4        SEND_VAL                                                 ~1
          5        FETCH_STATIC_PROP_R          unknown             ~2      'nombreUtilisateursInitialis%C3%A9s'
          6        SEND_VAL                                                 ~2
          7        FETCH_STATIC_PROP_R          unknown             ~3      'nombreUtilisateursInitialis%C3%A9s'
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                                 
   32    10        INIT_FCALL                                               'var_dump'
         11        FETCH_STATIC_PROP_R          unknown             ~5      'nombreAdminInitialis%C3%A9s'
         12        SEND_VAL                                                 ~5
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g4tlE
function name:  __construct
number of ops:  7
compiled vars:  !0 = $username, !1 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
          2        ASSIGN_OBJ                                               'username'
          3        OP_DATA                                                  !0
          4        ASSIGN_OBJ                                               'status'
          5        OP_DATA                                                  !1
   14     6      > RETURN                                                   null

End of function __construct

End of class User.

Class Admin:
Function nouvelleinitialisation:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g4tlE
function name:  nouvelleInitialisation
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   PRE_INC_STATIC_PROP                                      'nombreAdminInitialis%C3%A9s'
   25     1        PRE_INC_STATIC_PROP                                      'nombreUtilisateursInitialis%C3%A9s'
   26     2      > RETURN                                                   null

End of function nouvelleinitialisation

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g4tlE
function name:  __construct
number of ops:  7
compiled vars:  !0 = $username, !1 = $status
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
          2        ASSIGN_OBJ                                               'username'
          3        OP_DATA                                                  !0
          4        ASSIGN_OBJ                                               'status'
          5        OP_DATA                                                  !1
   14     6      > RETURN                                                   null

End of function __construct

End of class Admin.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.52 ms | 1456 KiB | 14 Q