3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Factoriel {public function calculate() { if(func_num_args() != 1) throw new Exception ("Invalid arguments count for method calculate!"); if(($n = (int)func_get_arg(0)) <= 0) throw new Exception ("Invalid argument supplied for method calculate!"); $result = 1; foreach(range(1, $n) as $current) $result = $this->multiply ($result, $current); return $result;}private function multiply($left, $right) { return bcmul("$left", "$right"); }}$factoriel = new Factoriel();echo $factoriel->calculate(a);?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Undefined constant "a" in /in/NqTVe:1 Stack trace: #0 {main} thrown in /in/NqTVe on line 1
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Use of undefined constant a - assumed 'a' (this will throw an Error in a future version of PHP) in /in/NqTVe on line 1 Fatal error: Uncaught Exception: Invalid argument supplied for method calculate! in /in/NqTVe:1 Stack trace: #0 /in/NqTVe(1): Factoriel->calculate('a') #1 {main} thrown in /in/NqTVe on line 1
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Use of undefined constant a - assumed 'a' in /in/NqTVe on line 1 Fatal error: Uncaught Exception: Invalid argument supplied for method calculate! in /in/NqTVe:1 Stack trace: #0 /in/NqTVe(1): Factoriel->calculate('a') #1 {main} thrown in /in/NqTVe on line 1
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
Notice: Use of undefined constant a - assumed 'a' in /in/NqTVe on line 1 Fatal error: Uncaught exception 'Exception' with message 'Invalid argument supplied for method calculate!' in /in/NqTVe:1 Stack trace: #0 /in/NqTVe(1): Factoriel->calculate('a') #1 {main} thrown in /in/NqTVe on line 1
Process exited with code 255.

preferences:
194.61 ms | 402 KiB | 257 Q