3v4l.org

run code in 300+ PHP versions simultaneously
<?php $allTags = [ '0' => [ "name" => "TAG-ONE", "video" => "64070,64076,64110,64111", ], '1' => [ "name" => "TAG-TWO", "video" => "64070,64076,64110,64111", ], '2' => [ "name" => "TAG-THREE", "video" => "64111", ] ]; $allTagsResult = array(); $format = array(); foreach( $allTags as $a ) { $name = $a['name']; $videos = explode(',', $a['video']); foreach( $videos as $v ) { if( !isset( $format[$v]) ) { $format[$v] = array(); } $format[$v][] = $name; } } foreach( $format as $video => $names) { $allTagsResult[] = array('name' => implode(',', $names), 'video' => $video); } echo '<pre>'; print_r($allTagsResult); die;
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => Array ( [name] => TAG-ONE,TAG-TWO [video] => 64070 ) [1] => Array ( [name] => TAG-ONE,TAG-TWO [video] => 64076 ) [2] => Array ( [name] => TAG-ONE,TAG-TWO [video] => 64110 ) [3] => Array ( [name] => TAG-ONE,TAG-TWO,TAG-THREE [video] => 64111 ) )

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