3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/^(?:([0-9]+) X,)? ?(?:([0-9]+) Y,)?(?: Z)?$/m'; $str = <<<_ 66 X, 55 Y, Z 66 X, 55 Y, 66 X, Z 55 Y, Z 66 X, 55 Y, \n _; preg_match_all($re, $str, $matches, PREG_SET_ORDER); foreach ($matches as $match) { unset($match[0]); foreach (['null', 'null'] as $key => $value) { if (!isset($match[$key + 1]) || $match[$key + 1] === '') $match[$key + 1] = $value; } echo implode(" - ", $match), PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
66 - 55 66 - 55 66 - null null - 55 66 - null null - 55 null - null

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:
34.61 ms | 405 KiB | 5 Q