3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'Hello how [t- are] you [k- today], Sir?'; $types = ['' => 'normal', 't' => 'target', 'k' => 'key']; if ( preg_match_all('~ (?| \[ (?<type>[^]-]+) - \h (?<content>[^]]+) ] | () ([^[]+) ) ~x', $str, $matches, PREG_SET_ORDER) ) { foreach ($matches as &$m) { unset($m[0], $m[1], $m[2]); $m['type'] = $types[$m['type']]; } print_r($matches); }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [type] => normal [content] => Hello how ) [1] => Array ( [type] => target [content] => are ) [2] => Array ( [type] => normal [content] => you ) [3] => Array ( [type] => key [content] => today ) [4] => Array ( [type] => normal [content] => , Sir? ) )

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:
175.59 ms | 407 KiB | 5 Q