3v4l.org

run code in 300+ PHP versions simultaneously
<?php function x($n) { for($i = 1; $i <= $n; $i++) { if ($n % $i == 0 && $i != $n) { $factors[] = $i; echo "$i is a factor of $n." . PHP_EOL; } elseif ($i == $n) { echo "Removing $n from array.."; } } var_dump($factors); $a = array_unique($factors); var_dump($a); echo "Removing duplicate factors."; return ($n == array_sum($a) / 2) ? true : false; } x(42); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kv09V
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'x'
          1        SEND_VAL                                                 42
          2        DO_FCALL                                      0          
   21     3      > RETURN                                                   1

Function x:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 3
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 3
Branch analysis from position: 27
Branch analysis from position: 3
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 3
Branch analysis from position: 27
Branch analysis from position: 3
Branch analysis from position: 24
Branch analysis from position: 8
filename:       /in/kv09V
function name:  x
number of ops:  49
compiled vars:  !0 = $n, !1 = $i, !2 = $factors, !3 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->25
    4     3    >   MOD                                              ~5      !0, !1
          4        IS_EQUAL                                         ~6      ~5, 0
          5      > JMPZ_EX                                          ~6      ~6, ->8
          6    >   IS_NOT_EQUAL                                     ~7      !1, !0
          7        BOOL                                             ~6      ~7
          8    > > JMPZ                                                     ~6, ->18
    5     9    >   ASSIGN_DIM                                               !2
         10        OP_DATA                                                  !1
    6    11        ROPE_INIT                                     4  ~10     !1
         12        ROPE_ADD                                      1  ~10     ~10, '+is+a+factor+of+'
         13        ROPE_ADD                                      2  ~10     ~10, !0
         14        ROPE_END                                      3  ~9      ~10, '.'
         15        CONCAT                                           ~12     ~9, '%0A'
         16        ECHO                                                     ~12
         17      > JMP                                                      ->24
    8    18    >   IS_EQUAL                                                 !1, !0
         19      > JMPZ                                                     ~13, ->24
    9    20    >   ROPE_INIT                                     3  ~15     'Removing+'
         21        ROPE_ADD                                      1  ~15     ~15, !0
         22        ROPE_END                                      2  ~14     ~15, '+from+array..'
         23        ECHO                                                     ~14
    3    24    >   PRE_INC                                                  !1
         25    >   IS_SMALLER_OR_EQUAL                                      !1, !0
         26      > JMPNZ                                                    ~18, ->3
   12    27    >   INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                                 
   13    30        INIT_FCALL                                               'array_unique'
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $20     
         33        ASSIGN                                                   !3, $20
   14    34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                                 
   15    37        ECHO                                                     'Removing+duplicate+factors.'
   16    38        INIT_FCALL                                               'array_sum'
         39        SEND_VAR                                                 !3
         40        DO_ICALL                                         $23     
         41        DIV                                              ~24     $23, 2
         42        IS_EQUAL                                                 !0, ~24
         43      > JMPZ                                                     ~25, ->46
         44    >   QM_ASSIGN                                        ~26     <true>
         45      > JMP                                                      ->47
         46    >   QM_ASSIGN                                        ~26     <false>
         47    > > RETURN                                                   ~26
   17    48*     > RETURN                                                   null

End of function x

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.38 ms | 1403 KiB | 20 Q