Skip to content

Commit f20f13d

Browse files
committed
php returns NULL on invalid input
```bash $ php -r '$x = hypot([], "a"); var_dump($x);' PHP Warning: hypot() expects parameter 1 to be double, array given in Command line code on line 1 Warning: hypot() expects parameter 1 to be double, array given in Command line code on line 1 NULL ```
1 parent e6a3d00 commit f20f13d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

functions/math/hypot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function hypot(x, y) {
44
// example 1: hypot(3, 4);
55
// returns 1: 5
66
// example 2: hypot([], 'a');
7-
// returns 2: 0
7+
// returns 2: null
88

99
return Math.sqrt(x * x + y * y) || 0;
10-
}
10+
}

0 commit comments

Comments
 (0)