3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [["label" => "Ai", "male" => 0, "female"=>10, ], ["label" => "Bi", "male" => 0, "female"=>20, ], ["label" => "Ci", "male" => 10, "female"=>20, ],]; //$minmax = 'min'; //$gen = 'male'; function getMinMaxGen($data,$minmax,$gen){ $res = ['value' => 0,'sets' => []]; if(in_array($minmax,['min','max'])){ $arcol = array_column($data,$gen); $res['value'] = $minmax($arcol); } if(in_array($gen,['male','female'])){ foreach($data as $person){ if ($person[$gen] === $res['value']) $res['sets'][] = ['label' => $person['label'], "$gen" => $person[$gen]]; } } return $res; } $result = getMinMaxGen($data,'max','female'); print_r($result); //print_r(getMinMaxGen($data,'min','female')); //print_r(getMinMaxGen($data,'max','male')); //print_r(getMinMaxGen($data,'min','male'));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.140.0100.01217.84
8.4.130.0100.00617.79
8.4.120.0050.00420.61
8.4.110.0110.00922.24
8.4.100.0120.01017.68
8.4.90.0050.00818.71
8.4.80.0150.00517.79
8.4.70.0070.00119.45
8.4.60.0140.00518.94
8.4.50.0120.01019.43
8.4.40.0070.01417.60
8.4.30.0070.01320.34
8.4.20.0100.01017.70
8.4.10.0130.00619.64
8.3.270.0090.01316.67
8.3.260.0050.00416.55
8.3.250.0100.00919.11
8.3.240.0020.00616.63
8.3.230.0060.00616.56
8.3.220.0080.01217.13
8.3.210.0110.00816.90
8.3.200.0070.00216.63
8.3.190.0070.01119.03
8.3.180.0040.00416.64
8.3.170.0130.00618.87
8.3.160.0070.00716.42
8.3.150.0190.00020.69
8.3.140.0040.00417.36
8.3.130.0040.00418.40
8.3.120.0060.00320.68
8.3.110.0030.00620.94
8.3.100.0040.00816.77
8.3.90.0090.00926.77
8.3.80.0100.00019.36
8.3.70.0090.00616.75
8.3.60.0080.01518.43
8.3.50.0070.01123.69
8.3.40.0070.01118.96
8.3.30.0070.00718.67
8.3.20.0060.00321.71
8.3.10.0040.00421.82
8.3.00.0040.00421.69
8.2.290.0100.00920.44
8.2.280.0060.00219.90
8.2.270.0120.00816.88
8.2.260.0150.00018.84
8.2.250.0090.00917.00
8.2.240.0030.00717.40
8.2.230.0090.00022.58
8.2.220.0090.00024.06
8.2.210.0100.00026.77
8.2.200.0070.00318.88
8.2.190.0110.00716.63
8.2.180.0090.00918.54
8.2.170.0120.00319.04
8.2.160.0070.01022.96
8.2.150.0050.00225.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0050.00326.16
8.2.110.0030.00720.52
8.2.100.0070.00417.78
8.2.90.0000.00817.84
8.2.80.0080.00018.73
8.2.70.0000.00917.50
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0080.00018.25
8.2.30.0000.00719.46
8.2.20.0040.00418.20
8.2.10.0040.00419.24
8.2.00.0040.00419.31
8.1.330.0070.01420.52
8.1.320.0110.00916.46
8.1.310.0000.00816.98
8.1.300.0060.01318.46
8.1.290.0090.00030.84
8.1.280.0060.00925.92
8.1.270.0040.00422.19
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0090.00022.12
8.1.230.0110.00020.94
8.1.220.0040.00417.77
8.1.210.0080.00018.77
8.1.200.0060.00317.35
8.1.190.0080.00017.11
8.1.180.0080.00018.10
8.1.170.0060.00318.46
8.1.160.0000.00718.97
8.1.150.0040.00418.91
8.1.140.0000.00720.83
8.1.130.0030.00317.38
8.1.120.0000.00717.39
8.1.110.0090.00017.32
8.1.100.0030.00617.51
8.1.90.0070.00017.46
8.1.80.0030.00617.38
8.1.70.0070.00017.47
8.1.60.0040.00417.55
8.1.50.0030.00617.55
8.1.40.0000.00817.41
8.1.30.0040.00417.61
8.1.20.0000.00817.68
8.1.10.0060.00317.61
8.1.00.0040.00417.54
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0030.00318.46
8.0.270.0030.00618.07
8.0.260.0000.01016.71
8.0.250.0040.00416.97
8.0.240.0060.00016.91
8.0.230.0040.00416.89
8.0.220.0040.00416.87
8.0.210.0070.00016.89
8.0.200.0030.00316.94
8.0.190.0040.00417.00
8.0.180.0000.00816.94
8.0.170.0000.00816.82
8.0.160.0050.00316.97
8.0.150.0070.00016.87
8.0.140.0050.00316.78
8.0.130.0000.00513.35
8.0.120.0030.00516.77
8.0.110.0030.00416.97
8.0.100.0000.00716.87
8.0.90.0090.00016.79
8.0.80.0030.01416.87
8.0.70.0050.00516.97
8.0.60.0040.00417.03
8.0.50.0000.00816.86
8.0.30.0120.00617.33
8.0.20.0050.01317.25
8.0.10.0070.00016.99
8.0.00.0180.00716.66
7.4.330.0050.00016.66
7.4.320.0000.00616.52
7.4.300.0060.00016.53
7.4.290.0000.00716.62
7.4.280.0050.00316.43
7.4.270.0030.00516.56
7.4.260.0050.00013.23
7.4.250.0040.00416.39
7.4.240.0020.00516.57
7.4.230.0050.00216.37
7.4.220.0020.00516.60
7.4.210.0150.00416.56
7.4.200.0000.00716.71
7.4.140.0120.01217.86
7.4.130.0090.01216.50
7.4.120.0110.01116.37
7.4.110.0070.01016.70
7.4.100.0070.01016.61
7.4.90.0000.01616.75
7.4.80.0020.01819.39
7.4.70.0100.00716.60
7.4.60.0130.00316.33
7.4.50.0070.00716.29
7.4.40.0060.01016.61
7.4.20.0120.00516.63
7.4.10.0150.00616.32
7.4.00.0100.00716.60
7.3.330.0000.00716.24
7.3.320.0000.00513.16
7.3.310.0030.00316.37
7.3.300.0060.00016.38
7.3.290.0050.01116.37
7.3.260.0170.00016.29
7.3.240.0090.01216.57
7.3.230.0050.01416.57
7.3.210.0100.01016.43
7.3.200.0100.00716.47
7.3.190.0080.00816.45
7.3.180.0030.01216.67
7.3.170.0130.00316.37
7.3.160.0030.01316.49
7.3.130.0160.00716.23
7.3.120.0070.01016.36
7.3.110.0120.01316.45
7.3.100.0110.00816.26
7.3.90.0130.01016.42
7.3.80.0030.01316.27
7.3.70.0070.01116.29
7.3.60.0120.00616.59
7.3.50.0100.00716.35
7.3.40.0120.00916.42
7.3.30.0100.00716.48
7.3.20.0070.01116.41
7.3.10.0160.01016.37
7.3.00.0090.00916.37
7.2.330.0030.01616.87
7.2.320.0060.01616.51
7.2.310.0100.00716.71
7.2.300.0140.00816.69
7.2.290.0190.00016.70
7.2.260.0090.01116.64
7.2.250.0030.01516.53
7.2.240.0100.01016.58
7.2.230.0130.00716.51
7.2.220.0180.00316.52
7.2.210.0110.00616.85
7.2.200.0150.00916.79
7.2.190.0140.00316.68
7.2.180.0150.00316.61
7.2.170.0100.00916.53
7.2.160.0120.00916.66
7.2.150.0090.00916.75
7.2.140.0110.01416.71
7.2.130.0070.01016.71
7.2.120.0150.00316.87
7.2.110.0110.00616.64
7.2.100.0070.01016.89
7.2.90.0270.00416.74
7.2.80.0100.00716.80
7.2.70.0000.01716.67
7.2.60.0110.00716.61
7.2.50.0060.01816.89
7.2.40.0150.00416.78
7.2.30.0100.00716.63
7.2.20.0100.00916.75
7.2.10.0190.00616.61
7.2.00.0060.01216.50

preferences:
32.87 ms | 403 KiB | 5 Q