3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data = [ 'Wellington New Zealand', 'Florida United States of America', 'Quebec Canada', 'Something Country XYZ (formally ABC)', ]; $countries = [ 'United States of America', 'Canada', 'New Zealand', 'Country XYZ (formally ABC)', ]; $branches = array_map(fn($country) => preg_quote($country, '/'), $countries); $result = []; foreach ($data as $string) { $result[] = preg_split('/ (?=(?:' . implode('|', $branches) . ')$)/', $string, 2); } var_export($result);
Output for rfc.property-hooks, git.master, git.master_jit
array ( 0 => array ( 0 => 'Wellington', 1 => 'New Zealand', ), 1 => array ( 0 => 'Florida', 1 => 'United States of America', ), 2 => array ( 0 => 'Quebec', 1 => 'Canada', ), 3 => array ( 0 => 'Something', 1 => 'Country XYZ (formally ABC)', ), )

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:
51.31 ms | 1308 KiB | 4 Q