3v4l.org

run code in 300+ PHP versions simultaneously
<?php $n = 2 * 1000 * 1000; $primes = []; for ($i = 2; $i < sqrt($n); $i++) { if (!isset($primes[$i])) { $primes[$i] = true; for ($j = 0; pow($i2, 2) + ($i*$j) < sqrt($n); $j++) { $primes[pow($i2, 2) + ($i*$j)] = false; } } } echo 'Sum of all primes below 2.000.000: ' . array_sum($primes);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 4
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 31
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 11
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 4
Branch analysis from position: 37
Branch analysis from position: 4
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 11
Branch analysis from position: 31
Branch analysis from position: 11
Branch analysis from position: 31
filename:       /in/2CQtn
function name:  (null)
number of ops:  43
compiled vars:  !0 = $n, !1 = $primes, !2 = $i, !3 = $j, !4 = $i2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 2000000
    5     1        ASSIGN                                                   !1, <array>
    7     2        ASSIGN                                                   !2, 2
          3      > JMP                                                      ->32
    8     4    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !1, !2
          5        BOOL_NOT                                         ~9      ~8
          6      > JMPZ                                                     ~9, ->31
    9     7    >   ASSIGN_DIM                                               !1, !2
          8        OP_DATA                                                  <true>
   11     9        ASSIGN                                                   !3, 0
         10      > JMP                                                      ->20
   12    11    >   INIT_FCALL                                               'pow'
         12        SEND_VAR                                                 !4
         13        SEND_VAL                                                 2
         14        DO_ICALL                                         $12     
         15        MUL                                              ~13     !2, !3
         16        ADD                                              ~14     $12, ~13
         17        ASSIGN_DIM                                               !1, ~14
         18        OP_DATA                                                  <false>
   11    19        PRE_INC                                                  !3
         20    >   INIT_FCALL                                               'pow'
         21        SEND_VAR                                                 !4
         22        SEND_VAL                                                 2
         23        DO_ICALL                                         $17     
         24        MUL                                              ~18     !2, !3
         25        ADD                                              ~19     $17, ~18
         26        INIT_FCALL                                               'sqrt'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $20     
         29        IS_SMALLER                                               ~19, $20
         30      > JMPNZ                                                    ~21, ->11
    7    31    >   PRE_INC                                                  !2
         32    >   INIT_FCALL                                               'sqrt'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $23     
         35        IS_SMALLER                                               !2, $23
         36      > JMPNZ                                                    ~24, ->4
   17    37    >   INIT_FCALL                                               'array_sum'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                         $25     
         40        CONCAT                                           ~26     'Sum+of+all+primes+below+2.000.000%3A+', $25
         41        ECHO                                                     ~26
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.13 ms | 1400 KiB | 19 Q