3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'Audi MODEL 80 ENGINE 1.9 TDi POWER 90Hk TORQUE 202Nm GEAR man DRIVE 2wd YEAR 1996', 'Audi MODEL 80 ENGINE 1.9 TDi YEAR 1996 NOTE this engine needs custom stage GEAR auto', 'Audi MODEL 80 ENGINE 1.9 TDi GEAR man YEAR 1996', 'Audi MODEL 80 ENGINE 1.9 TDi YEAR 1996 DRIVE 2wd' ]; foreach ($strings as $string) { preg_match_all('/\b([A-Z]+)\s+(\S+(?:\s+\S+)*?)(?=$|\s+[A-Z]+\b)/', 'MAKE ' . $string, $m, PREG_SET_ORDER); var_export(array_column($m, 2, 1)); echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'MAKE' => 'Audi', 'MODEL' => '80', 'ENGINE' => '1.9 TDi', 'POWER' => '90Hk', 'TORQUE' => '202Nm', 'GEAR' => 'man', 'DRIVE' => '2wd', 'YEAR' => '1996', ) --- array ( 'MAKE' => 'Audi', 'MODEL' => '80', 'ENGINE' => '1.9 TDi', 'YEAR' => '1996', 'NOTE' => 'this engine needs custom stage', 'GEAR' => 'auto', ) --- array ( 'MAKE' => 'Audi', 'MODEL' => '80', 'ENGINE' => '1.9 TDi', 'GEAR' => 'man', 'YEAR' => '1996', ) --- array ( 'MAKE' => 'Audi', 'MODEL' => '80', 'ENGINE' => '1.9 TDi', 'YEAR' => '1996', 'DRIVE' => '2wd', ) ---

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