3v4l.org

run code in 300+ PHP versions simultaneously
<?php $postcodes = ['SO30 0NG', 'SO30 OTD', 'SO31 1TG', 'RG51 5HG', 'RG51 7GH']; $result= array(); Foreach ($postcodes as $postcode){ $short =Substr($postcode,0,4); If(!isset($result[$short])) $result[$short]=[]; $result[$short][]= $short; } Var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { ["SO30"]=> array(2) { [0]=> string(4) "SO30" [1]=> string(4) "SO30" } ["SO31"]=> array(1) { [0]=> string(4) "SO31" } ["RG51"]=> array(2) { [0]=> string(4) "RG51" [1]=> string(4) "RG51" } }

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