3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const VERSION_INFO = '12abc34 (HEAD -> master, tag: 2.0.1)'; static function getVersion(): string { if (self::VERSION_INFO[0] === '$') { // fallback to other methods return ''; } if (preg_match('/^([0-9a-f]+).*?tag: ([\d\.]+)/', self::VERSION_INFO, $matched)) { return "{$matched[2]}-{$matched[1]}"; } // fallback to other methods } } var_dump(Foo::getVersion());
Output for git.master, git.master_jit, rfc.property-hooks
string(13) "2.0.1-12abc34"

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:
29.01 ms | 403 KiB | 8 Q