3v4l.org

run code in 300+ PHP versions simultaneously
<?php $season_data = [ 'Paul' => [ 'Season' => [2014, 2015, 2016] ], 'John' => [ 'Season' => [2012] ] ]; $appearance_data = [ 'Paul' => [ 'Appearance'=> [ 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2015, 2015, 2015 ] ], 'John' => [ 'Appearance' => [ 2012, 2012, 2012, 2012 ] ] ]; foreach ($season_data as $person => $data) { foreach ($data['Season'] as $year) { $result[$person]['SeasonCounts'][$year] = sizeof(array_filter( $appearance_data[$person]['Appearance'], function($v) use ($year) { return $v == $year; })); } } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'Paul' => array ( 'SeasonCounts' => array ( 2014 => 8, 2015 => 3, 2016 => 0, ), ), 'John' => array ( 'SeasonCounts' => array ( 2012 => 4, ), ), )

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