3v4l.org

run code in 300+ PHP versions simultaneously
<?php $weight = array('Galeria', 'Rss', 'Grande', 'Mediana'); //$weight = array(1, 3, 5); $options = array('Chico', 'Grande', 'Rss', 'Grande', 'Mediana'); // de las opciones disponibles obtener la de mayor peso $options = array_filter($options, function($item) use ($weight) {return in_array($item, $weight);}); $option = array_reduce($options, function(&$option, $item) use ($weight) { echo $option . PHP_EOL; return (array_search($option, $weight) < array_search($item, $weight)) ? $option : $item; //return ($option > $item) ? $option : $item; }, 'Mediana'); var_dump($option); die; $tamano = 'Rss'; echo $attachmentSizes[$tamano]; die; $fotos = array(array('idAdjunto' => 1, 'tamano' => 'Grande'), array('idAdjunto' => 2, 'tamano'=>'Galeria'), array('idAdjunto' => 3, 'tamano'=>'Mediana')); $foto = array_filter($fotos, function($foto) use ($attachmentSizes) { return in_array($foto['tamano'], $attachmentSizes); }); $foto = array_shift($foto); var_dump($foto);

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.60.0090.00618.68
8.3.50.0090.00717.38
8.3.40.0070.00718.66
8.3.30.0110.00418.84
8.3.20.0000.00818.77
8.3.10.0040.00418.85
8.3.00.0080.00019.13
8.2.180.0150.00016.63
8.2.170.0160.00322.96
8.2.160.0080.00818.96
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0120.00626.16
8.2.120.0040.00420.96
8.2.110.0070.00420.32
8.2.100.0060.00619.64
8.2.90.0000.00917.75
8.2.80.0080.00018.74
8.2.70.0030.00517.75
8.2.60.0000.00817.91
8.2.50.0040.00418.07
8.2.40.0080.00019.48
8.2.30.0080.00217.70
8.2.20.0060.00317.60
8.2.10.0040.00417.89
8.2.00.0000.00717.75
8.1.280.0040.01125.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00722.05
8.1.230.0120.00017.77
8.1.220.0040.00417.77
8.1.210.0000.00818.77
8.1.200.0030.00617.47
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0000.00818.95
8.1.160.0040.00419.09
8.1.150.0060.00318.72
8.1.140.0000.00717.45
8.1.130.0080.00017.40
8.1.120.0060.00317.56
8.1.110.0040.00417.38
8.1.100.0000.00717.51
8.1.90.0000.00817.38
8.1.80.0000.00717.50
8.1.70.0000.00717.52
8.1.60.0050.00517.60
8.1.50.0000.00717.46
8.1.40.0030.00617.45
8.1.30.0040.00417.62
8.1.20.0060.00317.60
8.1.10.0060.00317.42
8.1.00.0040.00417.37
8.0.300.0040.00419.04
8.0.290.0000.00816.74
8.0.280.0040.00418.63
8.0.270.0040.00417.22
8.0.260.0030.00318.41
8.0.250.0040.00417.14
8.0.240.0040.00416.94
8.0.230.0030.00517.07
8.0.220.0080.00017.01
8.0.210.0030.00316.90
8.0.200.0030.00317.07
8.0.190.0040.00416.97
8.0.180.0070.00017.09
8.0.170.0040.00416.92
8.0.160.0040.00417.00
8.0.150.0040.00417.04
8.0.140.0000.00816.94
8.0.130.0000.00513.46
8.0.120.0060.00316.89
8.0.110.0060.00316.93
8.0.100.0040.00416.84
8.0.90.0000.00717.05
8.0.80.0120.00917.07
8.0.70.0070.00016.86
8.0.60.0030.00517.11
8.0.50.0030.00517.07
8.0.30.0100.00517.31
8.0.20.0100.00917.24
8.0.10.0040.00417.02
8.0.00.0100.00817.04
7.4.330.0030.00313.03
7.4.320.0060.00016.63
7.4.300.0030.00316.66
7.4.290.0070.00016.50
7.4.280.0040.00416.55
7.4.270.0040.00416.55
7.4.260.0000.00713.35
7.4.250.0040.00416.54
7.4.240.0030.00316.70
7.4.230.0030.00316.54
7.4.220.0030.01516.61
7.4.210.0120.00916.58
7.4.200.0030.00316.55
7.4.190.0000.00716.82
7.4.160.0160.00016.47
7.4.150.0180.00416.54
7.4.140.0090.00917.86
7.4.130.0220.00416.57
7.4.120.0120.00916.47
7.4.110.0120.00616.54
7.4.100.0090.00916.70
7.4.90.0060.01216.75
7.4.80.0120.00619.39
7.4.70.0130.01016.46
7.4.60.0120.00916.56
7.4.50.0020.00216.54
7.4.40.0060.00616.42
7.4.30.0060.01116.68
7.4.00.0120.00314.89
7.3.330.0000.00713.21
7.3.320.0040.00413.38
7.3.310.0040.00416.42
7.3.300.0030.00316.27
7.3.290.0100.00516.45
7.3.280.0080.00616.42
7.3.270.0070.01016.68
7.3.260.0090.00816.37
7.3.240.0140.00316.41
7.3.230.0160.00616.34
7.3.210.0090.01216.39
7.3.200.0080.00816.34
7.3.190.0090.01216.61
7.3.180.0060.00916.60
7.3.170.0090.00916.44
7.3.160.0060.01616.56
7.3.120.0090.00914.93
7.3.110.0030.01314.64
7.3.100.0140.00314.90
7.3.90.0060.01014.98
7.3.80.0070.00714.85
7.3.70.0030.00714.91
7.3.60.0070.01114.86
7.3.50.0080.00814.57
7.3.40.0070.00714.73
7.3.30.0070.00714.83
7.3.20.0060.00316.82
7.3.10.0030.01216.66
7.3.00.0000.01316.66
7.2.330.0000.01816.77
7.2.320.0090.00916.77
7.2.310.0100.00916.82
7.2.300.0080.01616.58
7.2.290.0070.01316.81
7.2.240.0120.00414.98
7.2.230.0000.01415.07
7.2.220.0030.01314.96
7.2.210.0030.01315.31
7.2.200.0040.01514.94
7.2.190.0060.00715.08
7.2.180.0080.00415.19
7.2.170.0000.01015.21
7.2.160.0000.01314.95
7.2.150.0030.01216.60
7.2.140.0000.00916.91
7.2.130.0070.00716.98
7.2.120.0110.00717.02
7.2.110.0090.00317.07
7.2.100.0070.00716.85
7.2.90.0030.01016.81
7.2.80.0030.01016.78
7.2.70.0040.00816.93
7.2.60.0110.00016.65
7.2.50.0030.00616.86
7.2.40.0030.00616.75
7.2.30.0030.01017.10
7.2.20.0070.01117.01
7.2.10.0090.00917.00
7.2.00.0070.00717.98
7.1.330.0030.01315.54
7.1.320.0030.01316.01
7.1.310.0030.01015.67
7.1.300.0080.00415.81
7.1.290.0040.01015.66
7.1.280.0000.01415.56
7.1.270.0070.00315.82
7.1.260.0030.00715.88
7.1.250.0000.00715.83
7.1.200.0060.00615.91
7.1.100.0110.00018.22
7.1.70.0000.01917.19
7.1.60.0090.01619.25
7.1.50.0040.01917.10
7.1.00.0000.05722.31
7.0.200.0050.00316.75
7.0.140.0030.07322.09
7.0.120.0030.07022.04
7.0.60.0130.04719.87
7.0.50.0030.04717.96
7.0.40.0130.03720.31
7.0.30.0300.08020.13
7.0.20.0330.04320.23
7.0.10.0130.08720.22
7.0.00.0100.08320.24
5.6.210.0070.06020.47
5.6.200.0070.07318.29
5.6.190.0070.08020.33
5.6.180.0270.04320.59
5.6.170.0500.07320.48
5.6.160.0030.04020.54
5.6.150.0030.04018.28
5.6.140.0100.08318.12
5.6.130.0000.04318.21
5.6.120.0130.06321.01
5.6.110.0070.05320.98
5.6.100.0100.08321.01
5.6.90.0070.07021.09
5.6.80.0030.08720.40
5.6.70.4600.04020.36
5.5.350.0170.07320.53
5.5.340.0030.04318.05
5.5.330.0030.04020.29
5.5.320.0200.03720.27
5.5.310.0170.08320.34
5.5.300.0000.06317.98
5.5.290.0170.07318.04
5.5.280.0030.04720.97
5.5.270.0100.04320.88
5.5.260.0000.04720.77
5.5.250.0070.07720.70
5.5.240.0170.07020.18
5.4.450.0070.06719.20
5.4.440.0000.05719.30
5.4.430.0070.07719.56
5.4.420.0100.08019.37
5.4.410.0000.07019.34
5.4.400.0100.07018.89
5.4.390.0070.07318.88
5.4.380.0130.06319.05
5.4.370.0070.07318.85
5.4.360.0170.05319.24
5.4.350.0070.07719.12
5.4.340.0100.07019.14
5.4.320.0100.04319.30
5.4.310.0070.04719.24
5.4.300.0000.08319.16
5.4.290.0100.06019.24
5.4.280.0100.05318.85
5.4.270.0030.04019.07
5.4.260.0070.04319.15
5.4.250.0170.06319.20
5.4.240.0100.05719.23
5.4.230.0030.05718.87
5.4.220.0100.04019.04
5.4.210.0130.07319.16
5.4.200.0030.04319.24
5.4.190.0100.07019.23
5.4.180.0070.05719.14
5.4.170.0030.06719.15
5.4.160.0070.06719.23
5.4.150.0030.08019.22
5.4.140.0070.07716.59
5.4.130.0030.07716.42
5.4.120.0070.07016.61
5.4.110.0000.04016.38
5.4.100.0070.04016.35
5.4.90.0030.07316.50
5.4.80.0070.05316.53
5.4.70.0070.03316.45
5.4.60.0100.03016.50
5.4.50.0030.03716.40
5.4.40.0070.03316.35
5.4.30.0130.06316.50
5.4.20.0030.07016.39
5.4.10.0070.05316.42
5.4.00.0030.04015.86
5.3.290.0070.07714.70
5.3.280.0000.05314.62
5.3.270.0070.07014.66
5.3.260.0100.03714.62
5.3.250.0130.03714.69
5.3.240.0070.05714.66
5.3.230.0030.07014.65
5.3.220.0170.05714.63
5.3.210.0030.04314.75
5.3.200.0070.05014.57
5.3.190.0070.06314.63
5.3.180.0100.05714.61
5.3.170.0070.06014.57
5.3.160.0000.07014.58
5.3.150.0070.04714.46
5.3.140.0130.03314.59
5.3.130.0100.06014.57
5.3.120.0070.06314.61
5.3.110.0130.07014.48
5.3.100.0070.05313.97
5.3.90.0030.06714.07
5.3.80.0030.05014.19
5.3.70.0070.04713.91
5.3.60.0070.07713.98
5.3.50.0100.07013.96
5.3.40.0030.05314.02
5.3.30.0000.07713.81
5.3.20.0000.07713.74
5.3.10.0100.04713.71
5.3.00.0130.06713.61
5.2.170.0100.06011.08
5.2.160.0070.06311.07
5.2.150.0030.06311.11
5.2.140.0100.03311.30
5.2.130.0030.06011.04
5.2.120.0030.04311.08
5.2.110.0070.03311.25
5.2.100.0030.06711.04
5.2.90.0070.05011.01
5.2.80.0030.06011.07
5.2.70.0100.06011.01
5.2.60.0030.05011.20
5.2.50.0100.05711.01
5.2.40.0100.05711.01
5.2.30.0030.03711.01
5.2.20.0030.03011.01
5.2.10.0070.02711.01
5.2.00.0100.05011.01
5.1.60.0070.03011.01
5.1.50.0030.03011.01
5.1.40.0000.04311.01
5.1.30.0000.06011.01
5.1.20.0070.04011.01
5.1.10.0000.03711.01
5.1.00.0070.05711.01
5.0.50.0030.03311.01
5.0.40.0000.02011.01
5.0.30.0030.03311.01
5.0.20.0070.02711.01
5.0.10.0030.04711.01
5.0.00.0000.06711.01
4.4.90.0030.03311.01
4.4.80.0030.03711.01
4.4.70.0000.02711.01
4.4.60.0000.02311.01
4.4.50.0000.01711.01
4.4.40.0000.06011.01
4.4.30.0000.02311.01
4.4.20.0000.03711.01
4.4.10.0030.01311.01
4.4.00.0030.05711.01
4.3.110.0000.02711.01
4.3.100.0000.03711.01
4.3.90.0070.03011.01
4.3.80.0030.03711.01
4.3.70.0070.02311.01
4.3.60.0000.01711.01
4.3.50.0000.02311.01
4.3.40.0030.05311.01
4.3.30.0000.03711.01
4.3.20.0070.03011.01
4.3.10.0000.03311.01
4.3.00.0000.02311.01

preferences:
48.86 ms | 401 KiB | 5 Q