3v4l.org

run code in 300+ PHP versions simultaneously
<?php $class = get_class(new class { public static $count = 0; public function __construct() { self::$count++; } }); for ($i = 0; $i < 5; $i++) { $o = new $class(); } var_dump($o::$count);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
Branch analysis from position: 7
filename:       /in/7gGJ8
function name:  (null)
number of ops:  20
compiled vars:  !0 = $class, !1 = $i, !2 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_ANON_CLASS                               <unknown> 
          1        NEW                                              $4      $3
          2        DO_FCALL                                      0          
          3        GET_CLASS                                        ~6      $4
          4        ASSIGN                                                   !0, ~6
   12     5        ASSIGN                                                   !1, 0
          6      > JMP                                                      ->12
   13     7    >   FETCH_CLASS                                   0  $9      !0
          8        NEW                                              $10     $9
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $10
   12    11        PRE_INC                                                  !1
         12    >   IS_SMALLER                                               !1, 5
         13      > JMPNZ                                                    ~14, ->7
   16    14    >   INIT_FCALL                                               'var_dump'
         15        FETCH_CLASS                                   0  $15     !2
         16        FETCH_STATIC_PROP_R          unknown             ~16     'count'
         17        SEND_VAL                                                 ~16
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Class class@anonymous:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gGJ8
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   PRE_INC_STATIC_PROP                                      'count'
    9     1      > RETURN                                                   null

End of function __construct

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.25 ms | 1395 KiB | 15 Q