3v4l.org

run code in 300+ PHP versions simultaneously
<?php function d(): double {} function f(): float {} function i(): int {} function ie(): integer {} function r(): real {} function bn(): boolean {} foreach (['d', 'f'] as $name) { $ref = new ReflectionFunction($name); var_dump([$name, $ref->getReturnType()->getName(), $ref->getReturnType()->isBuiltin()]); }
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14, 8.5.0
Warning: "double" will be interpreted as a class name. Did you mean "float"? Write "\double" to suppress this warning in /in/T9iRf on line 3 Warning: "integer" will be interpreted as a class name. Did you mean "int"? Write "\integer" to suppress this warning in /in/T9iRf on line 6 Warning: "boolean" will be interpreted as a class name. Did you mean "bool"? Write "\boolean" to suppress this warning in /in/T9iRf on line 8 array(3) { [0]=> string(1) "d" [1]=> string(6) "double" [2]=> bool(false) } array(3) { [0]=> string(1) "f" [1]=> string(5) "float" [2]=> bool(true) }
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 8.3.28
/bin/php-8.3.28: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.3.28) /bin/php-8.3.28: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.3.28)
Process exited with code 1.

preferences:
76.3 ms | 408 KiB | 5 Q