3v4l.org

run code in 300+ PHP versions simultaneously
<?php $existing = []; $repeat_numbers = []; for ($rnd=1;$rnd<=50;$rnd++) { $randoms[] = mt_rand(0,25); // see this block for generating randoms } $i = 0; echo implode('-',$randoms).PHP_EOL; foreach($randoms as $rnd){ $i++; if(in_array($rnd,$existing)){ $repeat_numbers[] = $i; $i=1; $existing = []; } $existing[] = $rnd; } echo implode('-',$repeat_numbers); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 35
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 35
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 32
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 32
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
Branch analysis from position: 4
filename:       /in/TvD4S
function name:  (null)
number of ops:  42
compiled vars:  !0 = $existing, !1 = $repeat_numbers, !2 = $rnd, !3 = $randoms, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, 1
          3      > JMP                                                      ->11
    7     4    >   INIT_FCALL                                               'mt_rand'
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 25
          7        DO_ICALL                                         $9      
          8        ASSIGN_DIM                                               !3
          9        OP_DATA                                                  $9
    5    10        PRE_INC                                                  !2
         11    >   IS_SMALLER_OR_EQUAL                                      !2, 50
         12      > JMPNZ                                                    ~11, ->4
    9    13    >   ASSIGN                                                   !4, 0
   10    14        INIT_FCALL                                               'implode'
         15        SEND_VAL                                                 '-'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $13     
         18        CONCAT                                           ~14     $13, '%0A'
         19        ECHO                                                     ~14
   11    20      > FE_RESET_R                                       $15     !3, ->35
         21    > > FE_FETCH_R                                               $15, !2, ->35
   12    22    >   PRE_INC                                                  !4
   13    23        INIT_FCALL                                               'in_array'
         24        SEND_VAR                                                 !2
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $17     
         27      > JMPZ                                                     $17, ->32
   14    28    >   ASSIGN_DIM                                               !1
         29        OP_DATA                                                  !4
   15    30        ASSIGN                                                   !4, 1
   16    31        ASSIGN                                                   !0, <array>
   18    32    >   ASSIGN_DIM                                               !0
         33        OP_DATA                                                  !2
   11    34      > JMP                                                      ->21
         35    >   FE_FREE                                                  $15
   20    36        INIT_FCALL                                               'implode'
         37        SEND_VAL                                                 '-'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                         $22     
         40        ECHO                                                     $22
   21    41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.7 ms | 1017 KiB | 16 Q