3v4l.org

run code in 300+ PHP versions simultaneously
<?php const INT_CONST = 1; const FLOAT_CONST = 1.1; const STRING_CONST = ""; const BOOL_CONST = false; const ARRAY_CONST = []; function int_int(int $p = INT_CONST) {} // no error function int_string(int $p = STRING_CONST) {} // ERROR function int_bool(int $p = BOOL_CONST) {} // no error function int_float(int $p = FLOAT_CONST) {} // no error function int_array(int $p = ARRAY_CONST) {} // ERROR function float_int(float $p = INT_CONST) {} // no error function float_string(float $p = STRING_CONST) {} // ERROR function float_bool(float $p = BOOL_CONST) {} // no error function float_float(float $p = FLOAT_CONST) {} // no error function float_array(float $p = ARRAY_CONST) {} // ERROR function string_int(string $p = INT_CONST) {} // no error function string_string(string $p = STRING_CONST) {} // no error function string_bool(string $p = BOOL_CONST) {} // no error function string_float(string $p = FLOAT_CONST) {} // no error function string_array(string $p = ARRAY_CONST) {} // ERROR function bool_int(bool $p = INT_CONST) {} // no error function bool_string(bool $p = STRING_CONST) {} // no error function bool_bool(bool $p = BOOL_CONST) {} // no error function bool_float(bool $p = FLOAT_CONST) {} // no error function bool_array(bool $p = ARRAY_CONST) {} // ERROR function array_int(array $p = INT_CONST) {} // no error function array_string(array $p = STRING_CONST) {} // no error function array_bool(array $p = BOOL_CONST) {} // no error function array_float(array $p = FLOAT_CONST) {} // no error function array_array(array $p = ARRAY_CONST) {} // ERROR //array_int(); //array_string(); //array_bool(); array_float(); array_array();
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.14, 8.5.0 - 8.5.1
Fatal error: Uncaught TypeError: array_float(): Argument #1 ($p) must be of type array, float given, called in /in/KFUbf on line 42 and defined in /in/KFUbf:36 Stack trace: #0 /in/KFUbf(42): array_float() #1 {main} thrown in /in/KFUbf on line 36
Process exited with code 255.
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 7.0.0 - 7.0.33, 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: Argument 1 passed to array_float() must be of the type array, float given, called in /in/KFUbf on line 42 and defined in /in/KFUbf:36 Stack trace: #0 /in/KFUbf(42): array_float() #1 {main} thrown in /in/KFUbf on line 36
Process exited with code 255.
Output for 5.6.4 - 5.6.40
Catchable fatal error: Argument 1 passed to array_float() must be of the type array, double given, called in /in/KFUbf on line 42 and defined in /in/KFUbf on line 36
Process exited with code 255.
Output for 5.6.0 - 5.6.3
Fatal error: Default value for parameters with a class type hint can only be NULL in /in/KFUbf on line 9
Process exited with code 255.

preferences:
220.38 ms | 412 KiB | 5 Q