3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 0 => array( "AllotmentId" => "6b594c22-73f1-0a2a-298c-2d3feba2905d", "RoomId" => "9a21e427-16fd-7a9e-bc16-537dc55093bb" ), 1=> array( "AllotmentId"=> "99730f9a-2242-24bd-0908-b9035a75d328", "RoomId" => "9a21e427-16fd-7a9e-bc16-537dc55093bb" ), 2=> array( "AllotmentId"=> "fft54c22-73f1-0a2a-2558c-2d3fgged", "RoomId"=> "663ghjytf-16fd-7a9e-bc16-537dc55r5g0" ) ); $Roomid = array_count_values(array_column($array, "RoomId")); Foreach($Roomid as $room => $count){ $arr[] = ["Roomid" => $room, 'NumberOfAllotments' => $count]; } Echo "\$Roomid array:\n"; Var_dump($Roomid); Echo "\n\n\$arr array:\n"; Var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
$Roomid array: array(2) { ["9a21e427-16fd-7a9e-bc16-537dc55093bb"]=> int(2) ["663ghjytf-16fd-7a9e-bc16-537dc55r5g0"]=> int(1) } $arr array: array(2) { [0]=> array(2) { ["Roomid"]=> string(36) "9a21e427-16fd-7a9e-bc16-537dc55093bb" ["NumberOfAllotments"]=> int(2) } [1]=> array(2) { ["Roomid"]=> string(36) "663ghjytf-16fd-7a9e-bc16-537dc55r5g0" ["NumberOfAllotments"]=> int(1) } }

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