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.." . PHP_EOL; echo array_sum($factors) . " $n"; } } if ($n == array_sum($factors) / 2) { echo "It's perfect!" . PHP_EOL; } else { echo "It's not perfect!" . PHP_EOL; } } x(42); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NkL6
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'x'
          1        SEND_VAL                                                 42
          2        DO_FCALL                                      0          
   23     3      > RETURN                                                   1

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

End of function x

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.73 ms | 1407 KiB | 16 Q