3v4l.org

run code in 300+ PHP versions simultaneously
<?php $version = '5.5.58-0ubuntu0.14.04.1'; echo '<pre>'; var_dump(preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)); if (!preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)) { echo "RegEx failed on " . $version . PHP_EOL; } else { echo "RegEx extracted version parts" . PHP_EOL; var_dump($versionParts); } function errorValue($error) { $value = constant($error); return $value !== null ? $value : $error; } $errors = array( 'PREG_NO_ERROR', 'PREG_INTERNAL_ERROR', 'PREG_BACKTRACK_LIMIT_ERROR', 'PREG_RECURSION_LIMIT_ERROR', 'PREG_BAD_UTF8_ERROR', 'PREG_BAD_UTF8_OFFSET_ERROR', 'PREG_JIT_STACKLIMIT_ERROR' ); $pregErrors = array_combine( array_map('errorValue', $errors), $errors ); echo $pregErrors[preg_last_error()] . PHP_EOL; echo '</pre>';
Output for git.master, git.master_jit, rfc.property-hooks
<pre>int(1) RegEx extracted version parts array(7) { [0]=> string(6) "5.5.58" ["major"]=> string(1) "5" [1]=> string(1) "5" ["minor"]=> string(1) "5" [2]=> string(1) "5" ["patch"]=> string(2) "58" [3]=> string(2) "58" } PREG_NO_ERROR </pre>

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:
37.17 ms | 401 KiB | 8 Q