3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_hash($key): string { return $key; } var_dump( test_hash(1) , test_hash(new DateTime) );
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: test_hash(): Return value must be of type string, DateTime returned in /in/vvUgp:5 Stack trace: #0 /in/vvUgp(10): test_hash(Object(DateTime)) #1 {main} thrown in /in/vvUgp on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Return value of test_hash() must be of the type string, object returned in /in/vvUgp:5 Stack trace: #0 /in/vvUgp(10): test_hash(Object(DateTime)) #1 {main} thrown in /in/vvUgp on line 5
Process exited with code 255.

preferences:
161.62 ms | 403 KiB | 219 Q