3v4l.org

run code in 300+ PHP versions simultaneously
<?php $called = false; $_n_times_closure = function ($times) { return function (\Closure $closure) use ($times) { return function (...$parameters) use (&$times) { if (!$times) { return; } $times--; return $closure(...$parameters); }; }; }; $_once = $n_times_closure(1); $called = 0; $current_time = $_once(function() use (&$called) { return time(); }); var_dump($called, $current_time(), $called, $current_time(), $called);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6oW1
function name:  (null)
number of ops:  26
compiled vars:  !0 = $called, !1 = $_n_times_closure, !2 = $_once, !3 = $n_times_closure, !4 = $current_time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <false>
    5     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd6oW1%3A5%240'
          2        ASSIGN                                                   !1, ~6
   18     3        INIT_DYNAMIC_CALL                                        !3
          4        SEND_VAL_EX                                              1
          5        DO_FCALL                                      0  $8      
          6        ASSIGN                                                   !2, $8
   21     7        ASSIGN                                                   !0, 0
   22     8        INIT_DYNAMIC_CALL                                        !2
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd6oW1%3A22%243'
         10        BIND_LEXICAL                                             ~11, !0
   24    11        SEND_VAL_EX                                              ~11
         12        DO_FCALL                                      0  $12     
   22    13        ASSIGN                                                   !4, $12
   27    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        INIT_DYNAMIC_CALL                                        !4
         17        DO_FCALL                                      0  $14     
         18        SEND_VAR                                                 $14
         19        SEND_VAR                                                 !0
         20        INIT_DYNAMIC_CALL                                        !4
         21        DO_FCALL                                      0  $15     
         22        SEND_VAR                                                 $15
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fd6oW1%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6oW1
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $times
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd6oW1%3A6%241'
          2        BIND_LEXICAL                                             ~1, !0
   15     3      > RETURN                                                   ~1
   16     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd6oW1%3A5%240

Function %00%7Bclosure%7D%2Fin%2Fd6oW1%3A6%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6oW1
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $closure, !1 = $times
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    7     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd6oW1%3A7%242'
          3        BIND_LEXICAL                                             ~2, !1
   14     4      > RETURN                                                   ~2
   15     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd6oW1%3A6%241

Function %00%7Bclosure%7D%2Fin%2Fd6oW1%3A7%242:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6oW1
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $parameters, !1 = $times, !2 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_VARIADIC                                    !0      
          1        BIND_STATIC                                              !1
    8     2        BOOL_NOT                                         ~3      !1
          3      > JMPZ                                                     ~3, ->5
    9     4    > > RETURN                                                   null
   12     5    >   PRE_DEC                                                  !1
   13     6        INIT_DYNAMIC_CALL                                        !2
          7        SEND_UNPACK                                              !0
          8        CHECK_UNDEF_ARGS                                         
          9        DO_FCALL                                      1  $5      
         10      > RETURN                                                   $5
   14    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd6oW1%3A7%242

Function %00%7Bclosure%7D%2Fin%2Fd6oW1%3A22%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6oW1
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $called
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   BIND_STATIC                                              !0
   23     1        INIT_FCALL                                               'time'
          2        DO_ICALL                                         $1      
          3      > RETURN                                                   $1
   24     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd6oW1%3A22%243

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.73 ms | 1400 KiB | 17 Q