3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r(every(array(3,2,2))); print_r(every(array(1,2,3,4))); function every($levels) { $results = array(); $i = 0; while(true) { $current = $i; $result = array(); foreach(array_reverse($levels) as $max) { array_unshift($result, $current % $max); $current = intval($current / $max); } if($current >= 1) { break; } else { $results[] = $result; $i++; } } return $results; }

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rnOU4
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL_BY_NAME                                       'every'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
    5     6        INIT_FCALL                                               'print_r'
          7        INIT_FCALL_BY_NAME                                       'every'
          8        SEND_VAL_EX                                              <array>
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   29    12      > RETURN                                                   1

Function every:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 4
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 4
Branch analysis from position: 29
Branch analysis from position: 4
Branch analysis from position: 20
filename:       /in/rnOU4
function name:  every
number of ops:  31
compiled vars:  !0 = $levels, !1 = $results, !2 = $i, !3 = $current, !4 = $result, !5 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, <array>
    9     2        ASSIGN                                                   !2, 0
   11     3      > JMP                                                      ->28
   12     4    >   ASSIGN                                                   !3, !2
   14     5        ASSIGN                                                   !4, <array>
   15     6        INIT_FCALL                                               'array_reverse'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $10     
          9      > FE_RESET_R                                       $11     $10, ->20
         10    > > FE_FETCH_R                                               $11, !5, ->20
   16    11    >   INIT_FCALL                                               'array_unshift'
         12        SEND_REF                                                 !4
         13        MOD                                              ~12     !3, !5
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                                 
   17    16        DIV                                              ~14     !3, !5
         17        CAST                                          4  ~15     ~14
         18        ASSIGN                                                   !3, ~15
   15    19      > JMP                                                      ->10
         20    >   FE_FREE                                                  $11
   20    21        IS_SMALLER_OR_EQUAL                                      1, !3
         22      > JMPZ                                                     ~17, ->25
   21    23    > > JMP                                                      ->29
   20    24*       JMP                                                      ->28
   23    25    >   ASSIGN_DIM                                               !1
         26        OP_DATA                                                  !4
   24    27        PRE_INC                                                  !2
   11    28    > > JMPNZ                                                    <true>, ->4
   28    29    > > RETURN                                                   !1
   29    30*     > RETURN                                                   null

End of function every

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
272.13 ms | 1012 KiB | 16 Q