3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('memory_limit', -1); function find_primes($finish) { $number = 2; $range = range(2, $finish); $primes = array_combine($range, $range); while ($number * $number < $finish) { for ($i = $number; $i <= $finish; $i += $number) { if ($i == $number) { continue; } unset($primes[$i]); } $number = next($primes); } return $primes; } echo array_sum(find_primes(2000000));

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2NP03
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'memory_limit'
          2        SEND_VAL                                                 -1
          3        DO_ICALL                                                 
   24     4        INIT_FCALL                                               'array_sum'
          5        INIT_FCALL                                               'find_primes'
          6        SEND_VAL                                                 2000000
          7        DO_FCALL                                      0  $1      
          8        SEND_VAR                                                 $1
          9        DO_ICALL                                         $2      
         10        ECHO                                                     $2
         11      > RETURN                                                   1

Function find_primes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 13
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 15
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 13
Branch analysis from position: 29
Branch analysis from position: 13
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 15
Branch analysis from position: 22
Branch analysis from position: 15
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 15
Branch analysis from position: 22
Branch analysis from position: 15
filename:       /in/2NP03
function name:  find_primes
number of ops:  31
compiled vars:  !0 = $finish, !1 = $number, !2 = $range, !3 = $primes, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, 2
    9     2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 2
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
   10     7        INIT_FCALL                                               'array_combine'
          8        SEND_VAR                                                 !2
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !3, $8
   12    12      > JMP                                                      ->26
   13    13    >   ASSIGN                                                   !4, !1
         14      > JMP                                                      ->20
   14    15    >   IS_EQUAL                                                 !4, !1
         16      > JMPZ                                                     ~11, ->18
   15    17    > > JMP                                                      ->19
   17    18    >   UNSET_DIM                                                !3, !4
   13    19    >   ASSIGN_OP                                     1          !4, !1
         20    >   IS_SMALLER_OR_EQUAL                                      !4, !0
         21      > JMPNZ                                                    ~13, ->15
   19    22    >   INIT_FCALL                                               'next'
         23        SEND_REF                                                 !3
         24        DO_ICALL                                         $14     
         25        ASSIGN                                                   !1, $14
   12    26    >   MUL                                              ~16     !1, !1
         27        IS_SMALLER                                               ~16, !0
         28      > JMPNZ                                                    ~17, ->13
   21    29    > > RETURN                                                   !3
   22    30*     > RETURN                                                   null

End of function find_primes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.24 ms | 1403 KiB | 24 Q