3v4l.org

run code in 300+ PHP versions simultaneously
<?php { // The n-th prime we're aiming for $n = 444; // The first prime is the only even one $primes = array(1 => 2); // Loop counters $c = 1; $p = 3; $cnt =0; while (true) { // Check if $p is prime $prime = true; $sqrt = sqrt($p); for ($i = 1; $i < $c && $primes[$i] <= $sqrt; $i++) { if ($p % $primes[$i] == 0) { $prime = false; break; } } // Record $p if prime if ($prime) { $primes[++$c] = $p; $hexchr = base_convert($p, 10, 16); if (strpos($hexchr,'beef') !== false) { $beefprime[++$cnt]=$p; echo "$p HEX IS $hexchr\n"; } if ($cnt == $n) { break; } } // Next $p to check $p += 2; } echo "444th prime number is $beefprime[$n]"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 6
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 53
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 50
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 53
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 6
Branch analysis from position: 55
Branch analysis from position: 6
Branch analysis from position: 50
Branch analysis from position: 53
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
Branch analysis from position: 25
Branch analysis from position: 25
filename:       /in/oja67
function name:  (null)
number of ops:  60
compiled vars:  !0 = $n, !1 = $primes, !2 = $c, !3 = $p, !4 = $cnt, !5 = $prime, !6 = $sqrt, !7 = $i, !8 = $hexchr, !9 = $beefprime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 444
    7     1        ASSIGN                                                   !1, <array>
   10     2        ASSIGN                                                   !2, 1
   11     3        ASSIGN                                                   !3, 3
   12     4        ASSIGN                                                   !4, 0
   13     5      > JMP                                                      ->54
   16     6    >   ASSIGN                                                   !5, <true>
   17     7        INIT_FCALL                                               'sqrt'
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $16     
         10        ASSIGN                                                   !6, $16
   18    11        ASSIGN                                                   !7, 1
         12      > JMP                                                      ->20
   19    13    >   FETCH_DIM_R                                      ~19     !1, !7
         14        MOD                                              ~20     !3, ~19
         15        IS_EQUAL                                                 ~20, 0
         16      > JMPZ                                                     ~21, ->19
   20    17    >   ASSIGN                                                   !5, <false>
   21    18      > JMP                                                      ->26
   18    19    >   PRE_INC                                                  !7
         20    >   IS_SMALLER                                       ~24     !7, !2
         21      > JMPZ_EX                                          ~24     ~24, ->25
         22    >   FETCH_DIM_R                                      ~25     !1, !7
         23        IS_SMALLER_OR_EQUAL                              ~26     ~25, !6
         24        BOOL                                             ~24     ~26
         25    > > JMPNZ                                                    ~24, ->13
   26    26    > > JMPZ                                                     !5, ->53
   27    27    >   PRE_INC                                          ~27     !2
         28        ASSIGN_DIM                                               !1, ~27
         29        OP_DATA                                                  !3
   28    30        INIT_FCALL                                               'base_convert'
         31        SEND_VAR                                                 !3
         32        SEND_VAL                                                 10
         33        SEND_VAL                                                 16
         34        DO_ICALL                                         $29     
         35        ASSIGN                                                   !8, $29
   30    36        INIT_FCALL                                               'strpos'
         37        SEND_VAR                                                 !8
         38        SEND_VAL                                                 'beef'
         39        DO_ICALL                                         $31     
         40        TYPE_CHECK                                  1018          $31
         41      > JMPZ                                                     ~32, ->50
   31    42    >   PRE_INC                                          ~33     !4
         43        ASSIGN_DIM                                               !9, ~33
         44        OP_DATA                                                  !3
   32    45        ROPE_INIT                                     4  ~36     !3
         46        ROPE_ADD                                      1  ~36     ~36, '+HEX+IS+'
         47        ROPE_ADD                                      2  ~36     ~36, !8
         48        ROPE_END                                      3  ~35     ~36, '%0A'
         49        ECHO                                                     ~35
   34    50    >   IS_EQUAL                                                 !4, !0
         51      > JMPZ                                                     ~38, ->53
   35    52    > > JMP                                                      ->55
   40    53    >   ASSIGN_OP                                     1          !3, 2
   13    54    > > JMPNZ                                                    <true>, ->6
   42    55    >   NOP                                                      
         56        FETCH_DIM_R                                      ~40     !9, !0
         57        FAST_CONCAT                                      ~41     '444th+prime+number+is+', ~40
         58        ECHO                                                     ~41
   43    59      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.8 ms | 945 KiB | 20 Q