3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = function () { $cache = null; $closure = function () use (&$cache) { if ($cache === null) { $instance = new StdClass; $instance->param = 0; $cache = $instance; } $cache->param += 1; return $cache; }; return $closure; }; $provider = $foo(); var_dump($provider()); var_dump($provider());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6OON2
function name:  (null)
number of ops:  16
compiled vars:  !0 = $foo, !1 = $provider
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          1        ASSIGN                                                   !0, ~2
   20     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   22     5        INIT_FCALL                                               'var_dump'
          6        INIT_DYNAMIC_CALL                                        !1
          7        DO_FCALL                                      0  $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                                 
   23    10        INIT_FCALL                                               'var_dump'
         11        INIT_DYNAMIC_CALL                                        !1
         12        DO_FCALL                                      0  $8      
         13        SEND_VAR                                                 $8
         14        DO_ICALL                                                 
         15      > 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/6OON2
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $cache, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, null
    6     1        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          2        BIND_LEXICAL                                             ~3, !0
          3        ASSIGN                                                   !1, ~3
   17     4      > RETURN                                                   !1
   18     5*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/6OON2
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $cache, !1 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    7     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~2, ->9
    8     3    >   NEW                                              $3      'StdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
    9     6        ASSIGN_OBJ                                               !1, 'param'
          7        OP_DATA                                                  0
   10     8        ASSIGN                                                   !0, !1
   13     9    >   ASSIGN_OBJ_OP                                 1          !0, 'param'
         10        OP_DATA                                                  1
   15    11      > RETURN                                                   !0
   16    12*     > RETURN                                                   null

End of Dynamic Function 0

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.39 ms | 1003 KiB | 14 Q