3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cb = function (int $bar = "42") { };
Output for 8.5.0
Fatal error: Cannot use string as default value for parameter $bar of type int in /in/gq95J on line 2 Stack trace: #0 {main}
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.15
Fatal error: Cannot use string as default value for parameter $bar of type int in /in/gq95J on line 2
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Default value for parameters with a int type can only be int or NULL in /in/gq95J on line 2
Process exited with code 255.
Output for 7.0.3 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34
Fatal error: Default value for parameters with a integer type can only be integer or NULL in /in/gq95J on line 2
Process exited with code 255.
Output for 7.0.0 - 7.0.2
Fatal error: Default value for parameters with a integer type hint can only be integer or NULL in /in/gq95J on line 2
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Default value for parameters with a class type hint can only be NULL in /in/gq95J on line 2
Process exited with code 255.

preferences:
1543.49 ms | 1010 KiB | 7 Q