3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function isPerfect($n) { return count($n)==4&&$n[0]*$n[1]*$n[2]*$n[3]+1==$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])); var_dump(isPerfect([500,501,502,503])); var_dump(isPerfect(['a','b','c','d']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jvo1N
function name:  (null)
number of ops:  55
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     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                                                 
    9     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                                                 
   10    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                                                 
   11    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                                                 
   12    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'isperfect'
         26        SEND_VAL                                                 <array>
         27        DO_FCALL                                      0  $8      
         28        SEND_VAR                                                 $8
         29        DO_ICALL                                                 
   13    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'isperfect'
         32        SEND_VAL                                                 <array>
         33        DO_FCALL                                      0  $10     
         34        SEND_VAR                                                 $10
         35        DO_ICALL                                                 
   14    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL                                               'isperfect'
         38        SEND_VAL                                                 <array>
         39        DO_FCALL                                      0  $12     
         40        SEND_VAR                                                 $12
         41        DO_ICALL                                                 
   15    42        INIT_FCALL                                               'var_dump'
         43        INIT_FCALL                                               'isperfect'
         44        SEND_VAL                                                 <array>
         45        DO_FCALL                                      0  $14     
         46        SEND_VAR                                                 $14
         47        DO_ICALL                                                 
   16    48        INIT_FCALL                                               'var_dump'
         49        INIT_FCALL                                               'isperfect'
         50        SEND_VAL                                                 <array>
         51        DO_FCALL                                      0  $16     
         52        SEND_VAR                                                 $16
         53        DO_ICALL                                                 
         54      > RETURN                                                   1

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

End of function isperfect

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.9 ms | 1403 KiB | 24 Q