3v4l.org

run code in 300+ PHP versions simultaneously
<?php function subdivisor(){ $last = array(18, 10, 24, 10); $i = 0; return function () use (&$i, &$last) { if ($i >= count($last)) { $i = 2; } return $last[$i++]; }; } echo subdivisor()() . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DLYvK
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'subdivisor'
          1        DO_FCALL                                      0  $0      
          2        INIT_DYNAMIC_CALL                                        $0
          3        DO_FCALL                                      0  $1      
          4        CONCAT                                           ~2      $1, '%0A'
          5        ECHO                                                     ~2
   14     6      > RETURN                                                   1

Function subdivisor:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DLYvK
function name:  subdivisor
number of ops:  7
compiled vars:  !0 = $last, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 0
    5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDLYvK%3A5%240'
          3        BIND_LEXICAL                                             ~4, !1
          4        BIND_LEXICAL                                             ~4, !0
   10     5      > RETURN                                                   ~4
   11     6*     > RETURN                                                   null

End of function subdivisor

Function %00%7Bclosure%7D%2Fin%2FDLYvK%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/DLYvK
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $i, !1 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
    6     2        COUNT                                            ~2      !1
          3        IS_SMALLER_OR_EQUAL                                      ~2, !0
          4      > JMPZ                                                     ~3, ->6
    7     5    >   ASSIGN                                                   !0, 2
    9     6    >   POST_INC                                         ~5      !0
          7        FETCH_DIM_R                                      ~6      !1, ~5
          8      > RETURN                                                   ~6
   10     9*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.18 ms | 1399 KiB | 14 Q