3v4l.org

run code in 300+ PHP versions simultaneously
<?php function perfect($n) { if ($n < 1) { return false; } for($i = 1; $i <= $n; $i++) { if ($n % $i == 0) { $factors[] = $i; } } return ($n == array_sum($factors) / 2) ? true : false; } perfect($n=42); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZgEGA
function name:  (null)
number of ops:  5
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'perfect'
          1        ASSIGN                                           ~1      !0, 42
          2        SEND_VAL                                                 ~1
          3        DO_FCALL                                      0          
   16     4      > RETURN                                                   1

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

End of function perfect

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.11 ms | 1403 KiB | 16 Q