3v4l.org

run code in 500+ PHP versions simultaneously
<?php function map( $text = 'file', $elements = 5, $start = 1, $step = 1 ) { $end = $start + $elements * $step - 1; return array_map( fn($i) => $text . $i, range($start, $end, $step) ); } function loop( $text = 'file', $elements = 5, $start = 1, $step = 1 ) { $result = []; $end = $start + $elements * $step - 1; while ($start <= $end) { $result[] = $text . $start; $start += $step; } return $result; } var_export(map()); echo "\n---\n"; var_export(loop()); echo "\n---\n"; var_export(map('file', 5, 4, 20)); echo "\n---\n"; var_export(loop('file', 5, 4, 20)); echo "\n---\n"; var_export(map('file', 2)); echo "\n---\n"; var_export(loop('file', 2)); echo "\n---\n"; var_export(map('file', 3, 3, 7)); echo "\n---\n"; var_export(loop('file', 3, 3, 7)); echo "\n---\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d74JI
function name:  (null)
number of ops:  69
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                                   'var_export'
          1        INIT_FCALL                                                   'map'
          2        DO_FCALL                                          0  $0      
          3        SEND_VAR                                                     $0
          4        DO_ICALL                                                     
   32     5        ECHO                                                         '%0A---%0A'
   33     6        INIT_FCALL                                                   'var_export'
          7        INIT_FCALL                                                   'loop'
          8        DO_FCALL                                          0  $2      
          9        SEND_VAR                                                     $2
         10        DO_ICALL                                                     
   34    11        ECHO                                                         '%0A---%0A'
   35    12        INIT_FCALL                                                   'var_export'
         13        INIT_FCALL                                                   'map'
         14        SEND_VAL                                                     'file'
         15        SEND_VAL                                                     5
         16        SEND_VAL                                                     4
         17        SEND_VAL                                                     20
         18        DO_FCALL                                          0  $4      
         19        SEND_VAR                                                     $4
         20        DO_ICALL                                                     
   36    21        ECHO                                                         '%0A---%0A'
   37    22        INIT_FCALL                                                   'var_export'
         23        INIT_FCALL                                                   'loop'
         24        SEND_VAL                                                     'file'
         25        SEND_VAL                                                     5
         26        SEND_VAL                                                     4
         27        SEND_VAL                                                     20
         28        DO_FCALL                                          0  $6      
         29        SEND_VAR                                                     $6
         30        DO_ICALL                                                     
   38    31        ECHO                                                         '%0A---%0A'
   39    32        INIT_FCALL                                                   'var_export'
         33        INIT_FCALL                                                   'map'
         34        SEND_VAL                                                     'file'
         35        SEND_VAL                                                     2
         36        DO_FCALL                                          0  $8      
         37        SEND_VAR                                                     $8
         38        DO_ICALL                                                     
   40    39        ECHO                                                         '%0A---%0A'
   41    40        INIT_FCALL                                                   'var_export'
         41        INIT_FCALL                                                   'loop'
         42        SEND_VAL                                                     'file'
         43        SEND_VAL                                                     2
         44        DO_FCALL                                          0  $10     
         45        SEND_VAR                                                     $10
         46        DO_ICALL                                                     
   42    47        ECHO                                                         '%0A---%0A'
   43    48        INIT_FCALL                                                   'var_export'
         49        INIT_FCALL                                                   'map'
         50        SEND_VAL                                                     'file'
         51        SEND_VAL                                                     3
         52        SEND_VAL                                                     3
         53        SEND_VAL                                                     7
         54        DO_FCALL                                          0  $12     
         55        SEND_VAR                                                     $12
         56        DO_ICALL                                                     
   44    57        ECHO                                                         '%0A---%0A'
   45    58        INIT_FCALL                                                   'var_export'
         59        INIT_FCALL                                                   'loop'
         60        SEND_VAL                                                     'file'
         61        SEND_VAL                                                     3
         62        SEND_VAL                                                     3
         63        SEND_VAL                                                     7
         64        DO_FCALL                                          0  $14     
         65        SEND_VAR                                                     $14
         66        DO_ICALL                                                     
   46    67        ECHO                                                         '%0A---%0A'
         68      > RETURN                                                       1

Function map:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d74JI
function name:  map
number of ops:  21
compiled vars:  !0 = $text, !1 = $elements, !2 = $start, !3 = $step, !4 = $end
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV_INIT                                            !0      'file'
    5     1        RECV_INIT                                            !1      5
    6     2        RECV_INIT                                            !2      1
    7     3        RECV_INIT                                            !3      1
    9     4        MUL                                                  ~5      !1, !3
          5        ADD                                                  ~6      !2, ~5
          6        SUB                                                  ~7      ~6, 1
          7        ASSIGN                                                       !4, ~7
   10     8        INIT_FCALL                                                   'array_map'
   11     9        DECLARE_LAMBDA_FUNCTION                              ~9      [0]
         10        BIND_LEXICAL                                                 ~9, !0
         11        SEND_VAL                                                     ~9
   12    12        INIT_FCALL                                                   'range'
         13        SEND_VAR                                                     !2
         14        SEND_VAR                                                     !4
         15        SEND_VAR                                                     !3
         16        DO_ICALL                                             $10     
         17        SEND_VAR                                                     $10
   10    18        DO_ICALL                                             $11     
   12    19      > RETURN                                                       $11
   14    20*     > RETURN                                                       null


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

End of Dynamic Function 0

End of function map

Function loop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 10
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 10
Branch analysis from position: 16
Branch analysis from position: 10
filename:       /in/d74JI
function name:  loop
number of ops:  18
compiled vars:  !0 = $text, !1 = $elements, !2 = $start, !3 = $step, !4 = $result, !5 = $end
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV_INIT                                            !0      'file'
   18     1        RECV_INIT                                            !1      5
   19     2        RECV_INIT                                            !2      1
   20     3        RECV_INIT                                            !3      1
   22     4        ASSIGN                                                       !4, <array>
   23     5        MUL                                                  ~7      !1, !3
          6        ADD                                                  ~8      !2, ~7
          7        SUB                                                  ~9      ~8, 1
          8        ASSIGN                                                       !5, ~9
   24     9      > JMP                                                          ->14
   25    10    >   CONCAT                                               ~12     !0, !2
         11        ASSIGN_DIM                                                   !4
         12        OP_DATA                                                      ~12
   26    13        ASSIGN_OP                                         1          !2, !3
   24    14    >   IS_SMALLER_OR_EQUAL                                          !2, !5
         15      > JMPNZ                                                        ~14, ->10
   28    16    > > RETURN                                                       !4
   29    17*     > RETURN                                                       null

End of function loop

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
172.34 ms | 2062 KiB | 24 Q