3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generateNumbers() { $numbers = []; while ( count($numbers) < 7 ) { $number = rand(1,35); if ( !in_array($number, $numbers) ) { $numbers[] = $number; } } sort($numbers); return $numbers; } $numbers = generateNumbers(); $new = generateNumbers(); $counter = 1; while ( !empty(array_diff($numbers, $new)) ) { while ( in_array(implode(',',$new),$allNewNumbers) ) { $new = generateNumbers(); } $allNewNumbers[] = implode(',',$new); $counter++; echo 'counter: '.$counter.PHP_EOL; if ( $counter > 1000 ) { echo 'break'.PHP_EOL; break; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 8
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 9
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 35
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 9
Branch analysis from position: 21
Branch analysis from position: 9
filename:       /in/JWFnB
function name:  (null)
number of ops:  43
compiled vars:  !0 = $numbers, !1 = $new, !2 = $counter, !3 = $allNewNumbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'generatenumbers'
          1        DO_FCALL                                      0  $4      
          2        ASSIGN                                                   !0, $4
   14     3        INIT_FCALL                                               'generatenumbers'
          4        DO_FCALL                                      0  $6      
          5        ASSIGN                                                   !1, $6
   15     6        ASSIGN                                                   !2, 1
   16     7      > JMP                                                      ->35
   17     8    > > JMP                                                      ->12
   18     9    >   INIT_FCALL                                               'generatenumbers'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !1, $9
   17    12    >   INIT_FCALL                                               'in_array'
         13        INIT_FCALL                                               'implode'
         14        SEND_VAL                                                 '%2C'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $11     
         17        SEND_VAR                                                 $11
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $12     
         20      > JMPNZ                                                    $12, ->9
   20    21    >   INIT_FCALL                                               'implode'
         22        SEND_VAL                                                 '%2C'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                         $14     
         25        ASSIGN_DIM                                               !3
         26        OP_DATA                                                  $14
   21    27        PRE_INC                                                  !2
   22    28        CONCAT                                           ~16     'counter%3A+', !2
         29        CONCAT                                           ~17     ~16, '%0A'
         30        ECHO                                                     ~17
   23    31        IS_SMALLER                                               1000, !2
         32      > JMPZ                                                     ~18, ->35
   24    33    >   ECHO                                                     'break%0A'
   25    34      > JMP                                                      ->42
   16    35    >   INIT_FCALL                                               'array_diff'
         36        SEND_VAR                                                 !0
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                         $19     
         39        BOOL_NOT                                         ~20     $19
         40        BOOL_NOT                                         ~21     ~20
         41      > JMPNZ                                                    ~21, ->8
   27    42    > > RETURN                                                   1

Function generatenumbers:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 2
Branch analysis from position: 18
Branch analysis from position: 2
Branch analysis from position: 15
filename:       /in/JWFnB
function name:  generateNumbers
number of ops:  23
compiled vars:  !0 = $numbers, !1 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1      > JMP                                                      ->15
    5     2    >   INIT_FCALL                                               'rand'
          3        SEND_VAL                                                 1
          4        SEND_VAL                                                 35
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    6     7        INIT_FCALL                                               'in_array'
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $5      
         11        BOOL_NOT                                         ~6      $5
         12      > JMPZ                                                     ~6, ->15
    7    13    >   ASSIGN_DIM                                               !0
         14        OP_DATA                                                  !1
    4    15    >   COUNT                                            ~8      !0
         16        IS_SMALLER                                               ~8, 7
         17      > JMPNZ                                                    ~9, ->2
   10    18    >   INIT_FCALL                                               'sort'
         19        SEND_REF                                                 !0
         20        DO_ICALL                                                 
   11    21      > RETURN                                                   !0
   12    22*     > RETURN                                                   null

End of function generatenumbers

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.38 ms | 1009 KiB | 21 Q