3v4l.org

run code in 300+ PHP versions simultaneously
<?php function x($n) { echo "Factors: "; for($i = 1; $i <= $n; $i++) { if ($n % $i == 0 && $i != $n) { $factors[] = $i; echo "$i "; } } if ($n == array_sum($factors)) { echo "[$n = Perfect]"; } else { echo "[$n = Imperfect]"; } } x(28); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L5Ab8
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'x'
          1        SEND_VAL                                                 28
          2        DO_FCALL                                      0          
   20     3      > RETURN                                                   1

Function x:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 4
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 4
Branch analysis from position: 18
Branch analysis from position: 4
Branch analysis from position: 15
Branch analysis from position: 9
filename:       /in/L5Ab8
function name:  x
number of ops:  33
compiled vars:  !0 = $n, !1 = $i, !2 = $factors
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ECHO                                                     'Factors%3A+'
    4     2        ASSIGN                                                   !1, 1
          3      > JMP                                                      ->16
    5     4    >   MOD                                              ~4      !0, !1
          5        IS_EQUAL                                         ~5      ~4, 0
          6      > JMPZ_EX                                          ~5      ~5, ->9
          7    >   IS_NOT_EQUAL                                     ~6      !1, !0
          8        BOOL                                             ~5      ~6
          9    > > JMPZ                                                     ~5, ->15
    6    10    >   ASSIGN_DIM                                               !2
         11        OP_DATA                                                  !1
    7    12        NOP                                                      
         13        FAST_CONCAT                                      ~8      !1, '+'
         14        ECHO                                                     ~8
    4    15    >   PRE_INC                                                  !1
         16    >   IS_SMALLER_OR_EQUAL                                      !1, !0
         17      > JMPNZ                                                    ~10, ->4
   10    18    >   INIT_FCALL                                               'array_sum'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $11     
         21        IS_EQUAL                                                 !0, $11
         22      > JMPZ                                                     ~12, ->28
   11    23    >   ROPE_INIT                                     3  ~14     '%5B'
         24        ROPE_ADD                                      1  ~14     ~14, !0
         25        ROPE_END                                      2  ~13     ~14, '+%3D+Perfect%5D'
         26        ECHO                                                     ~13
         27      > JMP                                                      ->32
   14    28    >   ROPE_INIT                                     3  ~17     '%5B'
         29        ROPE_ADD                                      1  ~17     ~17, !0
         30        ROPE_END                                      2  ~16     ~17, '+%3D+Imperfect%5D'
         31        ECHO                                                     ~16
   16    32    > > RETURN                                                   null

End of function x

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.76 ms | 1394 KiB | 16 Q