3v4l.org

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

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

End of function generateprimes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.12 ms | 1403 KiB | 14 Q