3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = "/{([^{}]+)}/"; $string = "Hi, {Mr.|Mrs.} {Alvin|Dale}! Good Morning!"; $result = preg_split($pattern, $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $result = array_map(function($x) { return explode('|', $x); }, $result); var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 0 => 'Hi, ', ), 1 => array ( 0 => 'Mr.', 1 => 'Mrs.', ), 2 => array ( 0 => ' ', ), 3 => array ( 0 => 'Alvin', 1 => 'Dale', ), 4 => array ( 0 => '! Good Morning!', ), )

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:
170.7 ms | 406 KiB | 5 Q