3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverseString(string $text): string { $string = ''; for ($i = strlen($text); $i >= 0; $i--) { $string .= strlen($text, $i, 1); } return $string; throw new BadFunctionCallException("Please implement the reverseString method!"); } reverseString("hello");
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
Fatal error: Uncaught ArgumentCountError: strlen() expects exactly 1 argument, 3 given in /in/bN5U7:8 Stack trace: #0 /in/bN5U7(8): strlen('hello', 5, 1) #1 /in/bN5U7(15): reverseString('hello') #2 {main} thrown in /in/bN5U7 on line 8
Process exited with code 255.

preferences:
42.68 ms | 406 KiB | 5 Q