3v4l.org

run code in 500+ PHP versions simultaneously
<?php // First class callable function a() { static $c = 0; return $c++; } $c = a(...); $c = function () { static $c = 0; return $c++; }; print $c(); print $c(); $d = clone $c; print $d(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UmHpO
function name:  (null)
number of ops:  17
compiled vars:  !0 = $c, !1 = $d
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                                   'a'
          1        CALLABLE_CONVERT                                     ~2      
          2        ASSIGN                                                       !0, ~2
    7     3        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          4        ASSIGN                                                       !0, ~4
    9     5        INIT_DYNAMIC_CALL                                            !0
          6        DO_FCALL                                          0  $6      
          7        ECHO                                                         $6
   10     8        INIT_DYNAMIC_CALL                                            !0
          9        DO_FCALL                                          0  $7      
         10        ECHO                                                         $7
   11    11        CLONE                                                ~8      !0
         12        ASSIGN                                                       !1, ~8
   12    13        INIT_DYNAMIC_CALL                                            !1
         14        DO_FCALL                                          0  $10     
         15        ECHO                                                         $10
   14    16      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UmHpO
function name:  {closure:/in/UmHpO:7}
number of ops:  4
compiled vars:  !0 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   BIND_STATIC                                                  !0
          1        POST_INC                                             ~1      !0
          2      > RETURN                                                       ~1
          3*     > RETURN                                                       null

End of Dynamic Function 0

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UmHpO
function name:  a
number of ops:  4
compiled vars:  !0 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   BIND_STATIC                                                  !0
          1        POST_INC                                             ~1      !0
          2      > RETURN                                                       ~1
          3*     > RETURN                                                       null

End of function a

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.59 ms | 1104 KiB | 14 Q