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; } while ( ! isPrime($i = mt_rand(1, 999)) ); var_dump($i);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 1
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 1
filename:       /in/6nNWJ
function name:  (null)
number of ops:  15
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > JMP                                                      ->1
          1    >   INIT_FCALL                                               'isprime'
          2        INIT_FCALL                                               'mt_rand'
          3        SEND_VAL                                                 1
          4        SEND_VAL                                                 999
          5        DO_ICALL                                         $1      
          6        ASSIGN                                           ~2      !0, $1
          7        SEND_VAL                                                 ~2
          8        DO_FCALL                                      0  $3      
          9        BOOL_NOT                                         ~4      $3
         10      > JMPNZ                                                    ~4, ->1
   14    11    >   INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > 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/6nNWJ
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:
151.46 ms | 1394 KiB | 22 Q