3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generatePrimes($n) { $primes = [2]; for ($i = 3; $i < $n; $i += 2) { foreach ($primes as $prime) { if ($i % $prime == 0) continue 2; } $primes[] = $i; } return $primes; } var_dump(generatePrimes(5));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WlJJ8
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'generateprimes'
          2        SEND_VAL                                                 5
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function generateprimes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 4
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 4
Branch analysis from position: 18
Branch analysis from position: 4
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 4
Branch analysis from position: 18
Branch analysis from position: 4
Branch analysis from position: 12
filename:       /in/WlJJ8
function name:  generatePrimes
number of ops:  20
compiled vars:  !0 = $n, !1 = $primes, !2 = $i, !3 = $prime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 3
          3      > JMP                                                      ->16
    7     4    > > FE_RESET_R                                       $6      !1, ->12
          5    > > FE_FETCH_R                                               $6, !3, ->12
    8     6    >   MOD                                              ~7      !2, !3
          7        IS_EQUAL                                                 ~7, 0
          8      > JMPZ                                                     ~8, ->11
    9     9    >   FE_FREE                                                  $6
         10      > JMP                                                      ->15
    7    11    > > JMP                                                      ->5
         12    >   FE_FREE                                                  $6
   11    13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  !2
    6    15    >   ASSIGN_OP                                     1          !2, 2
         16    >   IS_SMALLER                                               !2, !0
         17      > JMPNZ                                                    ~11, ->4
   14    18    > > RETURN                                                   !1
   15    19*     > RETURN                                                   null

End of function generateprimes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.16 ms | 1399 KiB | 16 Q