3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Math { 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; } } } $m = new Math; $m->generatePrimes(5);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qmBX9
function name:  (null)
number of ops:  7
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Math'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_METHOD_CALL                                         !0, 'generatePrimes'
          4        SEND_VAL_EX                                              5
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

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

End of function generateprimes

End of class Math.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.05 ms | 1403 KiB | 13 Q