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; }); 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.70.0100.00618.68
8.3.60.0040.01418.43
8.3.50.0040.01322.11
8.3.40.0100.01018.80
8.3.30.0040.01118.67
8.3.20.0040.00418.57
8.3.10.0060.00320.66
8.3.00.0080.00023.66
8.2.180.0090.00916.35
8.2.170.0040.01122.96
8.2.160.0090.00920.52
8.2.150.0070.00324.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0000.00819.48
8.2.110.0100.00021.04
8.2.100.0110.00017.72
8.2.90.0040.00419.23
8.2.80.0030.00618.05
8.2.70.0050.00317.63
8.2.60.0040.00418.04
8.2.50.0060.00318.07
8.2.40.0000.00818.16
8.2.30.0030.00519.76
8.2.20.0000.00717.88
8.2.10.0000.00817.80
8.2.00.0030.00617.75
8.1.280.0100.01025.92
8.1.270.0000.00723.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.01122.54
8.1.230.0070.00420.88
8.1.220.0040.00418.77
8.1.210.0080.00018.96
8.1.200.0030.00617.35
8.1.190.0020.00517.40
8.1.180.0060.00318.10
8.1.170.0000.00818.64
8.1.160.0080.00018.80
8.1.150.0040.00418.55
8.1.140.0000.00717.54
8.1.130.0000.00717.85
8.1.120.0000.00717.39
8.1.110.0050.00317.38
8.1.100.0000.00817.46
8.1.90.0030.00517.41
8.1.80.0070.00017.56
8.1.70.0070.00017.52
8.1.60.0000.00817.55
8.1.50.0000.00817.47
8.1.40.0040.00417.54
8.1.30.0040.00417.65
8.1.20.0030.00517.54
8.1.10.0040.00417.60
8.1.00.0050.00317.37
8.0.300.0000.00720.04
8.0.290.0060.00316.75
8.0.280.0000.00818.48
8.0.270.0000.00717.29
8.0.260.0030.00316.90
8.0.250.0080.00017.02
8.0.240.0030.00617.00
8.0.230.0030.00516.94
8.0.220.0000.00717.00
8.0.210.0030.00316.97
8.0.200.0030.00317.07
8.0.190.0030.00616.92
8.0.180.0050.00316.92
8.0.170.0030.00616.94
8.0.160.0040.00417.00
8.0.150.0050.00316.84
8.0.140.0000.01116.97
8.0.130.0070.00013.30
8.0.120.0040.00416.83
8.0.110.0000.00816.98
8.0.100.0070.00016.86
8.0.90.0000.00716.86
8.0.80.0100.00717.05
8.0.70.0040.00416.99
8.0.60.0080.00016.89
8.0.50.0050.00316.99
8.0.30.0130.00717.31
8.0.20.0170.00717.40
8.0.10.0000.00816.93
8.0.00.0140.00516.96
7.4.330.0050.00013.43
7.4.320.0000.00716.61
7.4.300.0030.00316.64
7.4.290.0050.00216.60
7.4.280.0040.00416.59
7.4.270.0030.00516.59
7.4.260.0050.00013.18
7.4.250.0040.00416.65
7.4.240.0030.00316.44
7.4.230.0050.00216.62
7.4.220.0060.00916.53
7.4.210.0070.00716.61
7.4.200.0000.00716.73
7.4.190.0040.00416.60
7.4.160.0060.01016.52
7.4.150.0140.00517.40
7.4.140.0110.00717.86
7.4.130.0110.00816.65
7.4.120.0110.01016.56
7.4.110.0040.01316.63
7.4.100.0090.01216.66
7.4.90.0100.00716.60
7.4.80.0100.00719.37
7.4.70.0040.01416.54
7.4.60.0090.00716.37
7.4.50.0000.00816.66
7.4.40.0120.00222.27
7.4.30.0090.01316.74
7.4.00.0090.01015.19
7.3.330.0000.00513.38
7.3.320.0000.00713.40
7.3.310.0040.00416.48
7.3.300.0030.00316.43
7.3.290.0040.01116.38
7.3.280.0080.00816.38
7.3.270.0150.00317.40
7.3.260.0080.01118.24
7.3.250.0100.00816.56
7.3.240.0030.01316.31
7.3.230.0070.01016.39
7.3.210.0140.00416.35
7.3.200.0090.01219.39
7.3.190.0060.00916.46
7.3.180.0090.00616.37
7.3.170.0190.00316.48
7.3.160.0110.00516.41
7.3.120.0040.01114.76
7.3.110.0060.01215.15
7.3.100.0130.00314.65
7.3.90.0100.00314.95
7.3.80.0090.00315.07
7.3.70.0120.00014.68
7.3.60.0080.00814.75
7.3.50.0110.00414.98
7.3.40.0000.00814.91
7.3.30.0080.00414.70
7.3.20.0110.00316.38
7.3.10.0040.00816.82
7.3.00.0080.00816.64
7.2.330.0100.00616.57
7.2.320.0100.00616.62
7.2.310.0070.01116.73
7.2.300.0100.00716.66
7.2.290.0120.00616.52
7.2.250.0090.00915.09
7.2.240.0090.00415.08
7.2.230.0070.01315.29
7.2.220.0100.00315.00
7.2.210.0070.01015.02
7.2.200.0030.00915.06
7.2.190.0100.01015.13
7.2.180.0080.00415.15
7.2.170.0030.00614.96
7.1.330.0070.00715.96
7.1.320.0000.01215.45
7.1.310.0030.01015.86
7.1.300.0000.01515.73
7.1.290.0000.01015.73
7.1.280.0130.00315.64
7.1.270.0060.00915.74
7.1.260.0030.00715.96
7.1.70.0000.00717.09
7.1.60.0070.01719.40
7.1.50.0210.01734.85
7.1.00.0030.06022.48
7.0.200.0000.00816.76
7.0.140.0030.07322.05
7.0.60.0100.04720.04
7.0.50.0070.06317.90
7.0.40.0100.08320.24
7.0.30.0470.07320.33
7.0.20.0070.05020.19
7.0.10.0100.05720.30
7.0.00.0070.04020.34
5.6.210.0070.04720.63
5.6.200.0130.08018.27
5.6.190.0100.05020.46
5.6.180.0270.04320.50
5.6.170.0300.04020.55
5.6.160.0100.04720.56
5.6.150.0030.04018.16
5.6.140.0070.06718.18
5.6.130.0070.04018.11
5.6.120.0100.07320.97
5.6.110.0070.08021.05
5.6.100.0100.04720.96
5.6.90.0070.08721.04
5.6.80.0200.07020.40
5.5.350.0230.07020.50
5.5.340.0100.07718.00
5.5.330.0100.08320.48
5.5.320.0300.08320.34
5.5.310.0100.04720.27
5.5.300.0170.06017.93
5.5.290.0130.07017.95
5.5.280.0000.05720.99
5.5.270.0100.03320.98
5.5.260.0030.08320.65
5.5.250.0030.04020.47
5.5.240.0270.07320.14
5.4.450.0230.06319.65
5.4.440.0130.06319.42
5.4.430.0130.06319.39
5.4.420.0230.04019.52
5.4.410.0170.03719.26
5.4.400.0100.04719.01
5.4.390.0230.07019.22
5.4.380.0300.03019.15
5.4.370.0230.07719.04
5.4.360.0230.06319.15
5.4.350.0270.06719.08
5.4.340.0230.05019.17
5.4.320.0170.06019.20
5.4.310.0170.05019.00
5.4.300.0170.05318.85
5.4.290.0200.07319.13
5.4.280.0170.06019.14
5.4.270.0200.07319.14
5.4.260.0270.05019.13
5.4.250.0130.06019.05
5.4.240.0170.06319.17
5.4.230.0200.05318.97
5.4.220.0100.04719.23
5.4.210.0170.07719.21
5.4.200.0400.06019.07
5.4.190.0330.06019.20
5.4.180.0070.06019.15
5.4.170.0270.07719.20
5.4.160.0130.04719.20
5.4.150.0270.07319.30
5.4.140.0170.04716.55
5.4.130.0170.04716.56
5.4.120.0130.05016.39
5.4.110.0270.05716.24
5.4.100.0230.04316.61
5.4.90.0200.06716.61
5.4.80.0130.04016.28
5.4.70.0200.04716.55
5.4.60.0230.04316.45
5.4.50.0230.07016.51
5.4.40.0300.04016.42
5.4.30.0200.03316.42
5.4.20.0270.05716.53
5.4.10.0300.04016.55
5.4.00.0230.06315.95
5.3.290.0170.05014.68
5.3.280.0270.04314.53
5.3.270.0270.06714.63
5.3.260.0200.04014.58
5.3.250.0430.03314.73
5.3.240.0230.04014.64
5.3.230.0170.05014.59
5.3.220.0300.06714.50
5.3.210.0230.07714.55
5.3.200.0300.06314.57
5.3.190.0070.06314.59
5.3.180.0170.04314.62
5.3.170.0200.03714.48
5.3.160.0200.04714.65
5.3.150.0270.04014.57
5.3.140.0300.04714.47
5.3.130.0230.04314.64
5.3.120.0270.05014.60
5.3.110.0130.07714.47
5.3.100.0200.06714.05
5.3.90.0130.04314.12
5.3.80.0170.03313.95
5.3.70.0270.03014.19
5.3.60.0170.04313.94
5.3.50.0170.03714.04
5.3.40.0130.03713.97
5.3.30.0170.03713.90
5.3.20.0170.03313.71
5.3.10.0130.03313.57
5.3.00.0130.03713.57
5.2.170.0130.03312.18
5.2.160.0100.03712.18
5.2.150.0170.02312.18
5.2.140.0130.04012.18
5.2.130.0170.03312.18
5.2.120.0130.02712.18
5.2.110.0170.02312.18
5.2.100.0070.03312.18
5.2.90.0070.03312.18
5.2.80.0170.02312.18
5.2.70.0130.03012.18
5.2.60.0100.03012.18
5.2.50.0030.03312.18
5.2.40.0130.02312.18
5.2.30.0070.02712.18
5.2.20.0030.03312.18
5.2.10.0030.03312.18
5.2.00.0100.02712.18
5.1.60.0070.02712.18
5.1.50.0100.02312.18
5.1.40.0100.02312.18
5.1.30.0170.03012.18
5.1.20.0100.03312.18
5.1.10.0100.02312.18
5.1.00.0030.03012.18
5.0.50.0070.01712.18
5.0.40.0000.02012.18
5.0.30.0000.03712.18
5.0.20.0030.01712.18
5.0.10.0030.02012.18
5.0.00.0030.03012.18
4.4.90.0070.01312.18
4.4.80.0030.01712.18
4.4.70.0100.01312.18
4.4.60.0000.02012.18
4.4.50.0070.01312.18
4.4.40.0030.02312.18
4.4.30.0070.01312.18
4.4.20.0030.01312.18
4.4.10.0070.01312.18
4.4.00.0030.02312.18
4.3.110.0030.01712.18
4.3.100.0000.01712.18
4.3.90.0000.01712.18
4.3.80.0000.03312.18
4.3.70.0030.01712.18
4.3.60.0070.01312.18
4.3.50.0070.01712.18
4.3.40.0070.02312.18
4.3.30.0000.01712.18
4.3.20.0000.01712.18
4.3.10.0000.01712.18
4.3.00.0030.01312.18

preferences:
40.78 ms | 401 KiB | 5 Q