3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "50+16-0*387/2+49"; $digits = []; $symbols = []; preg_match_all("/(\d+)|(\D+)/", $str, $matches, PREG_SET_ORDER); foreach ($matches as $match) { if ($match[1] !== '') { $digits[] = $match[1]; } else { $symbols[] = $match[2]; } } var_export($digits); echo "\n---\n"; var_export($symbols);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => '50', 1 => '16', 2 => '0', 3 => '387', 4 => '2', 5 => '49', ) --- array ( 0 => '+', 1 => '-', 2 => '*', 3 => '/', 4 => '+', )

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