3v4l.org

run code in 300+ PHP versions simultaneously
<?php function prime($n) { $s = sqrt($n); for ($i = 2; $i <= $s; $i++) { if ($n % $i == 0) { return array_merge(prime($n/$i), array($i)); } } return array($n); } $prime = prime(42); print_r($prime); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C69XK
function name:  (null)
number of ops:  8
compiled vars:  !0 = $prime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'prime'
          1        SEND_VAL                                                 42
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   13     4        INIT_FCALL                                               'print_r'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   14     7      > RETURN                                                   1

Function prime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 7
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 7
Branch analysis from position: 23
Branch analysis from position: 7
filename:       /in/C69XK
function name:  prime
number of ops:  26
compiled vars:  !0 = $n, !1 = $s, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'sqrt'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    4     5        ASSIGN                                                   !2, 2
          6      > JMP                                                      ->21
    5     7    >   MOD                                              ~6      !0, !2
          8        IS_EQUAL                                                 ~6, 0
          9      > JMPZ                                                     ~7, ->20
    6    10    >   INIT_FCALL                                               'array_merge'
         11        INIT_FCALL_BY_NAME                                       'prime'
         12        DIV                                              ~8      !0, !2
         13        SEND_VAL_EX                                              ~8
         14        DO_FCALL                                      0  $9      
         15        SEND_VAR                                                 $9
         16        INIT_ARRAY                                       ~10     !2
         17        SEND_VAL                                                 ~10
         18        DO_ICALL                                         $11     
         19      > RETURN                                                   $11
    4    20    >   PRE_INC                                                  !2
         21    >   IS_SMALLER_OR_EQUAL                                      !2, !1
         22      > JMPNZ                                                    ~13, ->7
    9    23    >   INIT_ARRAY                                       ~14     !0
         24      > RETURN                                                   ~14
   10    25*     > RETURN                                                   null

End of function prime

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.63 ms | 1399 KiB | 20 Q