3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isPerfect($n) { return $n[0]*$n[1]*$n[2]*$n[3]+1==pow(pow($n[0],2)+3*$n[0]+1,2); } var_dump(isPerfect([1,2,3,4])); var_dump(isPerfect(['1','2','3','4'])); var_dump(isPerfect([3,9,5,6])); var_dump(isPerfect([1,2,3,4,5])); var_dump(isPerfect([a,b,c,d])); var_dump(isPerfect([1,b,3,4])); var_dump(isPerfect([1001,1002,1003,1004]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZZ5S
function name:  (null)
number of ops:  56
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'isperfect'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
    8     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'isperfect'
          8        SEND_VAL                                                 <array>
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
    9    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'isperfect'
         14        SEND_VAL                                                 <array>
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   10    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'isperfect'
         20        SEND_VAL                                                 <array>
         21        DO_FCALL                                      0  $6      
         22        SEND_VAR                                                 $6
         23        DO_ICALL                                                 
   11    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'isperfect'
         26        FETCH_CONSTANT                                   ~8      'a'
         27        INIT_ARRAY                                       ~9      ~8
         28        FETCH_CONSTANT                                   ~10     'b'
         29        ADD_ARRAY_ELEMENT                                ~9      ~10
         30        FETCH_CONSTANT                                   ~11     'c'
         31        ADD_ARRAY_ELEMENT                                ~9      ~11
         32        FETCH_CONSTANT                                   ~12     'd'
         33        ADD_ARRAY_ELEMENT                                ~9      ~12
         34        SEND_VAL                                                 ~9
         35        DO_FCALL                                      0  $13     
         36        SEND_VAR                                                 $13
         37        DO_ICALL                                                 
   12    38        INIT_FCALL                                               'var_dump'
         39        INIT_FCALL                                               'isperfect'
         40        INIT_ARRAY                                       ~15     1
         41        FETCH_CONSTANT                                   ~16     'b'
         42        ADD_ARRAY_ELEMENT                                ~15     ~16
         43        ADD_ARRAY_ELEMENT                                ~15     3
         44        ADD_ARRAY_ELEMENT                                ~15     4
         45        SEND_VAL                                                 ~15
         46        DO_FCALL                                      0  $17     
         47        SEND_VAR                                                 $17
         48        DO_ICALL                                                 
   13    49        INIT_FCALL                                               'var_dump'
         50        INIT_FCALL                                               'isperfect'
         51        SEND_VAL                                                 <array>
         52        DO_FCALL                                      0  $19     
         53        SEND_VAR                                                 $19
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Function isperfect:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZZ5S
function name:  isPerfect
number of ops:  25
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        FETCH_DIM_R                                      ~1      !0, 0
          2        FETCH_DIM_R                                      ~2      !0, 1
          3        MUL                                              ~3      ~1, ~2
          4        FETCH_DIM_R                                      ~4      !0, 2
          5        MUL                                              ~5      ~3, ~4
          6        FETCH_DIM_R                                      ~6      !0, 3
          7        MUL                                              ~7      ~5, ~6
          8        ADD                                              ~8      ~7, 1
          9        INIT_FCALL                                               'pow'
         10        INIT_FCALL                                               'pow'
         11        FETCH_DIM_R                                      ~9      !0, 0
         12        SEND_VAL                                                 ~9
         13        SEND_VAL                                                 2
         14        DO_ICALL                                         $10     
         15        FETCH_DIM_R                                      ~11     !0, 0
         16        MUL                                              ~12     ~11, 3
         17        ADD                                              ~13     $10, ~12
         18        ADD                                              ~14     ~13, 1
         19        SEND_VAL                                                 ~14
         20        SEND_VAL                                                 2
         21        DO_ICALL                                         $15     
         22        IS_EQUAL                                         ~16     $15, ~8
         23      > RETURN                                                   ~16
    5    24*     > RETURN                                                   null

End of function isperfect

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.86 ms | 1407 KiB | 24 Q