3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get($l, $c) { $value = 0; if (0 <= $c && $c <= $l && $l < 5000) { $tab = []; for ($i = 0; $i <= $l; $i++) { for ($j = 0; $j <= $c; $j++) { if ($i == $j || $i - 1 <= 0 || $j <= 0) { $tab[$i][$j] = 1; $value = $tab[$i][$j]; } elseif ($i != $j) { $tab[$i][$j] = bcadd($tab[$i - 1][$j - 1], $tab[$i - 1][$j]); $value = $tab[$i][$j]; } } } } return $value; } $result = get(67, 34); var_dump($result == '14226520737620288370'); echo $result;
Output for 7.3.0 - 7.3.31, 7.3.33, 7.4.0 - 7.4.25, 7.4.27 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
bool(true) 14226520737620288370
Output for 7.3.32, 7.4.26, 7.4.33, 8.0.13
Fatal error: Uncaught Error: Call to undefined function bcadd() in /in/BZOi6:18 Stack trace: #0 /in/BZOi6(27): get(67, 34) #1 {main} thrown in /in/BZOi6 on line 18
Process exited with code 255.

preferences:
212.19 ms | 407 KiB | 5 Q