3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( Array ( 'sexo_edad' => 'type1', 'fans' => 2 ), Array ( 'sexo_edad' => 'type2', 'fans' => 3 ), Array ( 'sexo_edad' => 'type1', 'fans' => 8 ), Array ( 'sexo_edad' => 'type2', 'fans' => 10 ) ); $type_values = array(); foreach ($array as &$arr) { if (isset($type_values[$arr['sexo_edad']])) { $arr['difference'] = $arr['fans'] - $type_values[$arr['sexo_edad']]; } else { $arr['difference'] = 0; } $type_values[$arr['sexo_edad']] = $arr['fans']; } print_r($array);

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.3.70.0130.00718.18
8.3.60.0110.00618.43
8.3.50.0070.00716.34
8.3.40.0060.00918.66
8.3.30.0040.01118.84
8.3.20.0000.00721.90
8.3.10.0080.00020.53
8.3.00.0050.00317.50
8.2.190.0080.00816.58
8.2.180.0120.00916.75
8.2.170.0140.00022.96
8.2.160.0110.00422.21
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00418.03
8.2.120.0000.00826.35
8.2.110.0030.00620.82
8.2.100.0090.00317.91
8.2.90.0040.00418.34
8.2.80.0040.00417.97
8.2.70.0030.00517.93
8.2.60.0040.00418.22
8.2.50.0050.00318.10
8.2.40.0070.00019.47
8.2.30.0070.00019.34
8.2.20.0000.00718.07
8.2.10.0040.00419.38
8.2.00.0040.00418.12
8.1.280.0090.00625.92
8.1.270.0000.00823.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00023.82
8.1.230.0110.00020.99
8.1.220.0030.00617.74
8.1.210.0030.00518.85
8.1.200.0080.00017.35
8.1.190.0040.00417.35
8.1.180.0050.00318.10
8.1.170.0040.00418.50
8.1.160.0000.00718.94
8.1.150.0080.00018.96
8.1.140.0040.00420.71
8.1.130.0030.00320.18
8.1.120.0040.00417.46
8.1.110.0060.00317.45
8.1.100.0040.00417.40
8.1.90.0000.00817.39
8.1.80.0100.00017.46
8.1.70.0000.00717.43
8.1.60.0040.00717.62
8.1.50.0080.00017.51
8.1.40.0040.00417.36
8.1.30.0000.00817.55
8.1.20.0040.00417.57
8.1.10.0060.00317.52
8.1.00.0050.00317.31
8.0.300.0080.00019.98
8.0.290.0030.00616.75
8.0.280.0060.00318.36
8.0.270.0000.00717.28
8.0.260.0030.00318.50
8.0.250.0050.00317.03
8.0.240.0000.00816.80
8.0.230.0080.00016.87
8.0.220.0070.00016.92
8.0.210.0030.00316.77
8.0.200.0030.00316.87
8.0.190.0080.00016.99
8.0.180.0080.00016.91
8.0.170.0040.00416.92
8.0.160.0040.00416.86
8.0.150.0070.00016.79
8.0.140.0000.00716.87
8.0.130.0000.00513.26
8.0.120.0060.00316.80
8.0.110.0000.00716.90
8.0.100.0070.00016.91
8.0.90.0030.00516.89
8.0.80.0050.01016.88
8.0.70.0040.00416.87
8.0.60.0080.00016.80
8.0.50.0050.00316.78
8.0.30.0130.00717.08
8.0.20.0140.00816.97
8.0.10.0000.00717.02
8.0.00.0120.00816.84
7.4.330.0000.00515.55
7.4.320.0030.00316.51
7.4.300.0030.00316.50
7.4.290.0030.00316.61
7.4.280.0000.00716.48
7.4.270.0070.00016.46
7.4.260.0000.00816.46
7.4.250.0000.00716.48
7.4.240.0030.00316.61
7.4.230.0000.00716.56
7.4.220.0080.00016.26
7.4.210.0050.00916.61
7.4.200.0030.00316.26
7.4.160.0080.00816.58
7.4.140.0060.01417.86
7.4.130.0130.00316.51
7.4.120.0070.01116.47
7.4.110.0060.01216.52
7.4.100.0160.00716.46
7.4.90.0070.01016.41
7.4.80.0050.01419.39
7.4.70.0130.00716.42
7.4.60.0100.01016.44
7.4.50.0000.01516.14
7.4.40.0090.00616.62
7.4.10.0000.01614.95
7.4.00.0060.01014.99
7.3.330.0030.00313.09
7.3.320.0030.00313.27
7.3.310.0070.00016.36
7.3.300.0070.00016.34
7.3.290.0040.00416.22
7.3.280.0130.00816.28
7.3.260.0110.01116.48
7.3.240.0130.00716.44
7.3.230.0090.00916.43
7.3.210.0030.01316.43
7.3.200.0060.00916.64
7.3.190.0130.00316.65
7.3.180.0130.00316.63
7.3.170.0080.00816.39
7.3.160.0110.00516.35
7.3.130.0080.00514.87
7.3.120.0090.00714.79
7.3.110.0070.00914.87
7.3.100.0060.01114.78
7.3.90.0050.01214.90
7.3.80.0110.00514.71
7.3.70.0110.00314.82
7.3.60.0070.00514.69
7.3.50.0060.00714.69
7.3.40.0070.00714.80
7.3.30.0070.00514.84
7.3.20.0110.00516.72
7.3.10.1560.00815.73
7.3.00.1270.00915.93
7.2.330.0070.01116.54
7.2.320.0030.01516.49
7.2.310.0030.01316.78
7.2.300.0120.00616.81
7.2.290.0060.01216.64
7.2.260.0070.00714.95
7.2.250.0080.00715.15
7.2.240.0100.01015.16
7.2.230.0080.00814.83
7.2.220.0060.01315.09
7.2.210.0100.00714.95
7.2.200.0070.00515.15
7.2.190.0050.00815.10
7.2.180.0070.00714.83
7.2.170.0070.00515.09
7.2.160.0060.00614.99
7.2.150.0090.00616.97
7.2.140.0070.00416.80
7.2.130.1700.00515.86
7.2.120.2000.00315.99
7.2.110.2210.00515.74
7.2.100.2040.00615.83
7.2.90.2700.01115.94
7.2.80.2040.01016.12
7.2.70.1830.00816.05
7.2.60.2180.00515.80
7.2.50.2450.00515.97
7.2.40.2430.00515.98
7.2.30.2310.00816.07
7.2.20.0440.00616.00
7.2.10.1980.00515.85
7.2.00.2280.01015.98
7.1.330.0040.01115.90
7.1.320.0090.00616.00
7.1.310.0070.00715.69
7.1.300.0060.00615.77
7.1.290.0070.00615.79
7.1.280.0000.01215.60
7.1.270.0050.00915.65
7.1.260.0050.00715.84
7.1.250.2000.00614.80
7.1.240.0030.01015.90
7.1.230.0070.00715.47
7.1.220.0100.00715.80
7.1.210.0060.01215.65
7.1.200.0070.00715.69
7.1.190.0040.00815.98
7.1.180.0060.00615.82
7.1.170.0110.00015.83
7.1.160.0110.00415.73
7.1.150.0070.00315.75
7.1.140.0030.01415.92
7.1.130.0110.00315.49
7.1.120.0030.01015.89
7.1.110.0040.00915.82
7.1.100.0060.00915.74
7.1.90.0090.00615.82
7.1.80.0090.00615.88
7.1.70.0060.00915.57
7.1.60.0120.00315.93
7.1.50.0080.00815.81
7.1.40.0060.00615.95
7.1.30.0000.01215.79
7.1.20.0040.00815.83
7.1.10.0070.00415.70
7.1.00.0040.00816.04

preferences:
67.83 ms | 401 KiB | 5 Q