3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LuckyNumbers { public function sumUp(array $digitsOfNumber1, array $digitsOfNumber2): int { $convNum1 = (int) implode($digitsOfNumber1); $convNum2 = (int) implode($digitsOfNumber2); return $convNum1+ $convNum2; throw new \BadFunctionCallException("Implement the function"); } public function isPalindrome(int $number): bool { // Reversing steps:- $numberString = (string) $number; $reverseNumberString = strrev($numberString); $reverseNumber = (int) $reverseNumberString; return $number == $reverseNumber; throw new \BadFunctionCallException("Implement the function"); } public function validate(string $input): string { if ($input <= 0) { echo "Must be a whole number larger than 0"; } if ($input == '') { echo "Required field"; } } } $lucky_numbers = new LuckyNumbers(); $lucky_numbers->validate('123');
Output for git.master_jit, git.master
Fatal error: Uncaught TypeError: LuckyNumbers::validate(): Return value must be of type string, none returned in /in/sa7qN:36 Stack trace: #0 /in/sa7qN(40): LuckyNumbers->validate('123') #1 {main} thrown in /in/sa7qN on line 36
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
28.68 ms | 405 KiB | 5 Q