3v4l.org

run code in 500+ PHP versions simultaneously
<?php use function PHPStan\dumpType; use function PHPStan\Testing\assertType; function doFoo(string $namespace):void { if (substr($namespace, 0, 4) === 'hello-world') {var_dump(__LINE__);} if ('hello-world' === substr($namespace, 0, 4)) {var_dump(__LINE__);} if (substr($namespace, 0, 13) === 'hello-world') {var_dump(__LINE__);} if ('hello-world' === substr($namespace, 0, 13)) {var_dump(__LINE__);} if (substr($namespace, 0, 11) === 'hello-world') {var_dump(__LINE__);} if ('hello-world' === substr($namespace, 0, 11)) {var_dump(__LINE__);} } doFoo('hello-world'); var_dump('--'); doFoo('abc'); var_dump('--'); doFoo('hello-world-in-php');
Output for master
int(10) int(11) int(13) int(14) string(2) "--" string(2) "--" int(13) int(14)

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:
13.03 ms | 1163 KiB | 7 Q