3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = Array ( 0 => Array ( "student" => "STD-000001", "marks" => 78, "total_subjects" => 1, "avarage" => 78 ), 1 => Array ( "student" => "STD-000002", "marks" => 60.4, "total_subjects" => 1, "avarage" => 60.4 ), 2=> Array ( "student" => "STD-000002", "marks" => 80.4, "total_subjects" => 1, "avarage" => 80.4 ) ); $avarage = array_column($arr, "avarage"); Arsort($avarage); $i=0; Foreach($avarage as $key => $val){ $res[$i] = $arr[$key]; $res[$i]['position'] = $i+1; $i++; } Var_dump($res);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(5) { ["student"]=> string(10) "STD-000002" ["marks"]=> float(80.4) ["total_subjects"]=> int(1) ["avarage"]=> float(80.4) ["position"]=> int(1) } [1]=> array(5) { ["student"]=> string(10) "STD-000001" ["marks"]=> int(78) ["total_subjects"]=> int(1) ["avarage"]=> int(78) ["position"]=> int(2) } [2]=> array(5) { ["student"]=> string(10) "STD-000002" ["marks"]=> float(60.4) ["total_subjects"]=> int(1) ["avarage"]=> float(60.4) ["position"]=> int(3) } }

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:
163.97 ms | 407 KiB | 5 Q