3v4l.org

run code in 300+ PHP versions simultaneously
<?php $gmp = gmp_init('42'); var_dump($gmp); var_dump($gmp instanceof Stringable); var_dump(in_array('__toString', array_column((new ReflectionObject($gmp))->getMethods(), 'name'), true)); echo "\n"; var_dump((string)$gmp); var_dump(''.$gmp); (function (string $x) { var_dump($x); })($gmp); echo "\n"; var_dump((int)$gmp); var_dump(+$gmp); (function (int $x) { var_dump($x); })($gmp);
Output for git.master, git.master_jit, rfc.property-hooks
object(GMP)#1 (1) { ["num"]=> string(2) "42" } bool(false) bool(false) string(2) "42" string(2) "42" string(2) "42" int(42) object(GMP)#5 (1) { ["num"]=> string(2) "42" } Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($x) must be of type int, GMP given, called in /in/cRnnW on line 14 and defined in /in/cRnnW:14 Stack trace: #0 /in/cRnnW(14): {closure}(Object(GMP)) #1 {main} thrown in /in/cRnnW on line 14
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.13 ms | 401 KiB | 8 Q