3v4l.org

run code in 300+ PHP versions simultaneously
<?php $infoArray =array( array( 'season'=>'winter 2014', 'link'=>'link1' ), array( 'season'=>'summer 2013', 'link'=>'link2' ), array( 'season'=>'fall 2012', 'link'=>'link3' ), array( 'season'=>'summer 2014', 'link'=>'link4' ), array( 'season'=>'winter 2013', 'link'=>'link5' ) ); $newArray =array(); $innerArray=array(); foreach ($infoArray as $info){ $season = explode(" ", $info['season']); $seasonName = $season[0]; $seasonYear = $season[1]; if (array_key_exists($seasonYear, $newArray)) { $newArray[$seasonYear][$seasonName]=$info['link'] ; } else { $innerArray[$seasonName] = $info['link']; $newArray[$seasonYear]=$innerArray ; } } var_dump($newArray);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [2014]=> array(2) { ["winter"]=> string(5) "link1" ["summer"]=> string(5) "link4" } [2013]=> array(2) { ["winter"]=> string(5) "link5" ["summer"]=> string(5) "link2" } [2012]=> array(3) { ["winter"]=> string(5) "link1" ["summer"]=> string(5) "link2" ["fall"]=> string(5) "link3" } }

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:
37.83 ms | 402 KiB | 8 Q