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 ; } }
Output for git.master, git.master_jit, rfc.property-hooks

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:
36.33 ms | 401 KiB | 8 Q