3v4l.org

run code in 300+ PHP versions simultaneously
<?php function problem_3() { $task = 600851475143; $sqrt = ceil(sqrt($task)); if (0 === $sqrt % 2) { $sqrt++; } for ($i = $sqrt; $i >= 1; $i = $i - 2) { if (0 !== $task % $i) { continue; } if ($i === (int)gmp_nextprime($i - 1)) { return $i; } } return -1; } // echo problem_3(); // echo (int)gmp_nextprime(5000 -1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L28j0
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E > > RETURN                                                   1

Function problem_3:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 14
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 14
Branch analysis from position: 30
Branch analysis from position: 14
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 12
filename:       /in/L28j0
function name:  problem_3
number of ops:  32
compiled vars:  !0 = $task, !1 = $sqrt, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 600851475143
    7     1        INIT_FCALL                                               'ceil'
          2        INIT_FCALL                                               'sqrt'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        SEND_VAR                                                 $4
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
    9     8        MOD                                              ~7      !1, 2
          9        IS_IDENTICAL                                             ~7, 0
         10      > JMPZ                                                     ~8, ->12
   10    11    >   PRE_INC                                                  !1
   13    12    >   ASSIGN                                                   !2, !1
         13      > JMP                                                      ->28
   14    14    >   MOD                                              ~11     !0, !2
         15        IS_NOT_IDENTICAL                                         ~11, 0
         16      > JMPZ                                                     ~12, ->18
   15    17    > > JMP                                                      ->26
   18    18    >   INIT_FCALL_BY_NAME                                       'gmp_nextprime'
         19        SUB                                              ~13     !2, 1
         20        SEND_VAL_EX                                              ~13
         21        DO_FCALL                                      0  $14     
         22        CAST                                          4  ~15     $14
         23        IS_IDENTICAL                                             !2, ~15
         24      > JMPZ                                                     ~16, ->26
   19    25    > > RETURN                                                   !2
   13    26    >   SUB                                              ~17     !2, 2
         27        ASSIGN                                                   !2, ~17
         28    >   IS_SMALLER_OR_EQUAL                                      1, !2
         29      > JMPNZ                                                    ~19, ->14
   22    30    > > RETURN                                                   -1
   23    31*     > RETURN                                                   null

End of function problem_3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
282.67 ms | 1008 KiB | 15 Q