3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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']));
based on 9ZKqC
Output for 7.1.0 - 7.2.0
bool(false) bool(false) bool(false) bool(false) Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 bool(true) Warning: A non-numeric value encountered in /in/Jvo1N on line 5 bool(false) bool(false) bool(false) Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 Warning: A non-numeric value encountered in /in/Jvo1N on line 5 bool(true)
Output for 7.0.0 - 7.0.20
bool(false) bool(false) bool(false) bool(false) bool(true) bool(false) bool(false) bool(false) bool(true)
Output for 5.6.8 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/Jvo1N on line 2 bool(false) bool(false) bool(false) bool(false) bool(true) bool(false) bool(false) bool(false) bool(true)
Output for 5.3.18 - 5.5.35
Warning: Unsupported declare 'strict_types' in /in/Jvo1N on line 2 Parse error: syntax error, unexpected '*' in /in/Jvo1N on line 5
Process exited with code 255.