3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isPrime($number) { $max = floor(sqrt($number)); for ($i=1; $i < $max; $i++) { if ($number % $i == 0) return false; } return true; } do { $i = mt_rand(100, 9999); } while ( ! isPrime($i) ); var_dump($i);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 0
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 0
filename:       /in/pqgp5
function name:  (null)
number of ops:  14
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'mt_rand'
          1        SEND_VAL                                                 100
          2        SEND_VAL                                                 9999
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   14     5        INIT_FCALL                                               'isprime'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $3      
          8        BOOL_NOT                                         ~4      $3
          9      > JMPNZ                                                    ~4, ->0
   16    10    >   INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function isprime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
Branch analysis from position: 10
filename:       /in/pqgp5
function name:  isPrime
number of ops:  19
compiled vars:  !0 = $number, !1 = $max, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'floor'
          2        INIT_FCALL                                               'sqrt'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        SEND_VAR                                                 $3
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
    5     8        ASSIGN                                                   !2, 1
          9      > JMP                                                      ->15
    6    10    >   MOD                                              ~7      !0, !2
         11        IS_EQUAL                                                 ~7, 0
         12      > JMPZ                                                     ~8, ->14
    7    13    > > RETURN                                                   <false>
    5    14    >   PRE_INC                                                  !2
         15    >   IS_SMALLER                                               !2, !1
         16      > JMPNZ                                                    ~10, ->10
    9    17    > > RETURN                                                   <true>
   10    18*     > RETURN                                                   null

End of function isprime

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.66 ms | 1403 KiB | 22 Q