3v4l.org

run code in 300+ PHP versions simultaneously
<?php $weight = array('Galeria', 'Rss', 'Grande', 'Mediana'); var_dump($weight['Galeria']); die; //$weight = array(1, 3, 5); $options = array('Chico', 'Grande', 'Rss', 'Galeria', '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 $item . PHP_EOL; return ($weight[$option] > $weight[$item]) ? $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.60.0040.01116.50
8.3.50.0090.00821.83
8.3.40.0110.00418.67
8.3.30.0110.00419.08
8.3.20.0060.00320.28
8.3.10.0040.00423.61
8.3.00.0050.00320.94
8.2.180.0110.01116.75
8.2.170.0090.00622.96
8.2.160.0000.01320.52
8.2.150.0030.00624.18
8.2.140.0070.00024.66
8.2.130.0000.00726.16
8.2.120.0040.00420.95
8.2.110.0030.00622.26
8.2.100.0060.00619.57
8.2.90.0050.00319.17
8.2.80.0000.00817.97
8.2.70.0030.00617.50
8.2.60.0000.00817.68
8.2.50.0080.00018.07
8.2.40.0030.00620.98
8.2.30.0070.00018.20
8.2.20.0040.00417.85
8.2.10.0000.00718.08
8.2.00.0050.00317.66
8.1.280.0200.00025.92
8.1.270.0080.00023.80
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00322.10
8.1.230.0000.01119.07
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0100.00017.13
8.1.190.0050.00317.35
8.1.180.0060.00318.10
8.1.170.0030.00618.51
8.1.160.0040.00421.99
8.1.150.0000.00718.68
8.1.140.0120.00017.43
8.1.130.0000.00717.78
8.1.120.0000.00717.46
8.1.110.0080.00017.34
8.1.100.0040.00417.42
8.1.90.0070.00317.42
8.1.80.0040.00417.43
8.1.70.0060.00317.43
8.1.60.0000.00817.57
8.1.50.0040.00417.59
8.1.40.0000.00817.56
8.1.30.0040.00417.62
8.1.20.0040.00417.67
8.1.10.0040.00417.46
8.1.00.0000.00817.54
8.0.300.0070.00018.77
8.0.290.0050.00317.05
8.0.280.0040.00418.42
8.0.270.0000.00717.29
8.0.260.0030.00317.30
8.0.250.0030.00317.03
8.0.240.0030.00317.05
8.0.230.0040.00416.98
8.0.220.0050.00316.84
8.0.210.0000.00716.98
8.0.200.0030.00317.01
8.0.190.0030.00617.00
8.0.180.0080.00016.95
8.0.170.0070.00016.99
8.0.160.0000.00816.84
8.0.150.0040.00416.91
8.0.140.0040.00416.78
8.0.130.0030.00313.23
8.0.120.0040.00416.91
8.0.110.0070.00017.00
8.0.100.0040.00416.80
8.0.90.0000.00816.89
8.0.80.0040.01116.99
8.0.70.0030.00317.05
8.0.60.0000.00816.82
8.0.50.0030.00516.96
8.0.30.0120.00917.25
8.0.20.0100.00917.40
8.0.10.0000.00717.03
8.0.00.0160.00416.78
7.4.330.0040.00315.00
7.4.320.0000.00916.48
7.4.300.0000.00616.50
7.4.290.0030.00316.57
7.4.280.0030.00516.46
7.4.270.0040.00416.49
7.4.260.0080.00216.57
7.4.250.0080.00016.58
7.4.240.0040.00316.38
7.4.230.0030.00316.50
7.4.220.0100.00916.58
7.4.210.0090.00916.57
7.4.200.0030.00316.69
7.4.190.0030.00316.71
7.4.160.0130.00316.54
7.4.150.0120.00917.40
7.4.140.0100.01017.86
7.4.130.0120.00516.69
7.4.120.0040.01216.51
7.4.110.0170.00716.46
7.4.100.0090.00916.52
7.4.90.0040.01516.37
7.4.80.0030.01519.39
7.4.70.0030.01416.61
7.4.60.0130.00516.49
7.4.50.0000.00616.55
7.4.40.0130.00316.46
7.4.30.0080.01316.57
7.4.00.0090.01014.86
7.3.330.0000.00613.36
7.3.320.0000.00513.25
7.3.310.0050.00316.32
7.3.300.0000.00716.33
7.3.290.0070.00716.28
7.3.280.0080.01016.31
7.3.270.0220.00717.40
7.3.260.0100.00816.27
7.3.250.0100.00716.39
7.3.240.0060.01216.44
7.3.230.0100.00716.39
7.3.210.0130.00516.34
7.3.200.0110.01119.39
7.3.190.0160.00716.56
7.3.180.0040.01116.27
7.3.170.0130.00316.34
7.3.160.0120.00416.45
7.3.120.0050.01215.03
7.3.110.0100.00714.78
7.3.100.0000.01314.72
7.3.90.0060.00915.00
7.3.80.0100.00714.52
7.3.70.0060.00614.89
7.3.60.0030.01214.90
7.3.50.0070.01014.66
7.3.40.0110.00314.64
7.3.30.0040.00714.92
7.3.20.0060.00616.60
7.3.10.0030.01016.73
7.3.00.0080.00516.64
7.2.330.0090.00916.61
7.2.320.0150.00416.72
7.2.310.0150.00716.47
7.2.300.0100.00716.63
7.2.290.0160.00316.57
7.2.250.0030.01615.09
7.2.240.0070.01415.15
7.2.230.0090.00614.82
7.2.220.0110.00814.90
7.2.210.0060.00914.86
7.2.200.0080.00414.89
7.2.190.0030.01214.77
7.2.180.0060.00914.73
7.2.170.0000.00915.01
7.2.130.0070.00716.78
7.2.120.0030.01017.00
7.2.110.0120.01116.52
7.2.100.0040.01116.69
7.2.90.0070.00716.75
7.2.80.0060.00916.82
7.2.70.0000.01016.86
7.2.60.0030.00816.82
7.2.50.0090.00616.54
7.2.40.0030.01116.90
7.2.30.0030.01316.76
7.2.20.0060.00616.80
7.2.10.0110.00716.79
7.2.00.0040.00416.63
7.1.330.0070.00715.86
7.1.320.0040.01215.88
7.1.310.0060.01215.68
7.1.300.0030.01315.77
7.1.290.0040.00715.73
7.1.280.0030.01015.70
7.1.270.0040.00815.68
7.1.260.0070.00315.73
7.1.250.0000.00815.52
7.1.240.0070.00715.43
7.1.230.0030.01015.73
7.1.220.0070.00015.73
7.1.210.0030.00715.68
7.1.200.0060.00415.75
7.1.190.0000.01415.79
7.1.180.0070.00715.69
7.1.170.0070.00715.80
7.1.160.0040.00715.71
7.1.150.0070.00715.68
7.1.140.0030.00415.52
7.1.130.0060.00615.73
7.1.120.0070.01015.51
7.1.110.0040.01115.81
7.1.100.0040.01115.81
7.1.90.0070.00715.83
7.1.80.0100.00315.86
7.1.70.0100.00016.42
7.1.60.0070.01117.62
7.1.50.0110.00716.43
7.1.40.0080.00415.72
7.1.30.0070.00715.91
7.1.20.0110.00315.78
7.1.10.0000.01515.55
7.1.00.0050.04019.11
7.0.330.0110.00415.46
7.0.320.0030.00715.20
7.0.310.0000.01015.50
7.0.300.0040.01115.12
7.0.290.0040.00415.16
7.0.280.0050.00315.19
7.0.270.0000.00715.23
7.0.260.0040.01115.15
7.0.250.0030.00715.30
7.0.240.0040.00415.34
7.0.230.0120.00315.16
7.0.220.0080.00415.29
7.0.210.0110.00315.11
7.0.200.0060.00716.10
7.0.190.0110.00315.38
7.0.180.0090.00015.27
7.0.170.0030.00915.06
7.0.160.0030.01415.41
7.0.150.0110.00015.32
7.0.140.0080.03818.42
7.0.130.0060.00315.34
7.0.120.0030.00715.17
7.0.110.0000.01215.38
7.0.100.0070.00715.21
7.0.90.0080.00315.47
7.0.80.0100.00315.54
7.0.70.0100.00315.35
7.0.60.0080.01918.61
7.0.50.0070.02516.72
7.0.40.1630.03116.60
7.0.30.1620.02516.76
7.0.20.1830.02516.77
7.0.10.1950.02716.70
7.0.00.1820.02616.89
5.6.380.0070.00714.34
5.6.370.0040.00414.38
5.6.360.0030.00914.39
5.6.350.0070.00714.36
5.6.340.0030.01014.41
5.6.330.0060.00814.40
5.6.320.0030.00914.34
5.6.310.0060.01014.29
5.6.300.0060.00314.06
5.6.290.0060.00613.82
5.6.280.0020.04417.75
5.6.270.0110.00414.16
5.6.260.0030.00614.35
5.6.250.0090.00614.20
5.6.240.0000.01113.94
5.6.230.0070.00714.26
5.6.220.0110.00014.17
5.6.210.0030.02917.37
5.6.200.0050.03216.08
5.6.190.1880.02217.42
5.6.180.1650.02017.46
5.6.170.1900.02517.51
5.6.160.0080.02517.38
5.6.150.0050.04517.26
5.6.140.1750.02217.26
5.6.130.1850.02417.30
5.6.120.0830.03817.43
5.6.110.0120.04017.30
5.6.100.2080.02417.33
5.6.90.2000.02517.22
5.6.80.2030.02416.94
5.6.70.1800.02017.07
5.6.60.2070.02817.15
5.6.50.1950.02017.04
5.6.40.2010.02017.05
5.6.30.2100.02516.88
5.6.20.2000.03116.85
5.6.10.1700.02816.89
5.6.00.1730.02516.88
5.5.380.0000.00611.01
5.5.370.0050.00210.85
5.5.360.0000.00611.13
5.5.350.0100.04315.73
5.5.340.0050.03614.52
5.5.330.0600.03615.58
5.5.320.1780.02315.69
5.5.310.2120.02715.75
5.5.300.1720.03015.80
5.5.290.1780.02615.62
5.5.280.0050.04615.70
5.5.270.0070.03715.73
5.5.260.1900.02515.74
5.5.250.2090.02515.58
5.5.240.1920.02615.16
5.5.230.1650.02015.37
5.5.220.1980.02115.17
5.5.210.2000.02415.16
5.5.200.1630.02515.10
5.5.190.1870.03415.32
5.5.180.1830.01915.35
5.5.170.0060.00611.15
5.5.160.1710.02115.31
5.5.150.1780.02415.33
5.5.140.1800.02215.14
5.5.130.2120.01815.18
5.5.120.2190.01815.18
5.5.110.2050.02115.17
5.5.100.2070.02315.13
5.5.90.2070.02815.21
5.5.80.2010.01615.30
5.5.70.1760.02115.11
5.5.60.1780.02115.16
5.5.50.1680.02215.21
5.5.40.2080.02215.11
5.5.30.2180.02215.28
5.5.20.2150.02015.31
5.5.10.2080.02115.36
5.5.00.1760.02315.18
5.4.450.1700.01815.26
5.4.440.0130.03515.19
5.4.430.0950.03015.37
5.4.420.2040.01815.39
5.4.410.2170.02015.21
5.4.400.2000.02215.04
5.4.390.1700.02315.04
5.4.380.1670.02515.02
5.4.370.2150.01715.13
5.4.360.2030.01715.05
5.4.350.1830.02115.04
5.4.340.1700.02615.12
5.4.330.0070.00310.77
5.4.320.1740.02414.90
5.4.310.1780.02314.99
5.4.300.1780.02415.19
5.4.290.1780.02514.96
5.4.280.2130.02414.99
5.4.270.1950.02315.00
5.4.260.1900.02515.08
5.4.250.2080.02015.07
5.4.240.1730.02015.03
5.4.230.1800.02215.22
5.4.220.1430.01715.04
5.4.210.1630.02314.94
5.4.200.1800.02214.82
5.4.190.2160.02914.76
5.4.180.1990.01815.04
5.4.170.1780.02214.97
5.4.160.1730.02514.91
5.4.150.2010.02014.90
5.4.140.1810.01813.67
5.4.130.1630.02213.72
5.4.120.1650.02013.74
5.4.110.1670.01913.63
5.4.100.1600.02113.67
5.4.90.1580.02213.87
5.4.80.1580.02213.80
5.4.70.1930.02013.69
5.4.60.1700.02013.52
5.4.50.1820.02213.63
5.4.40.1770.01713.85
5.4.30.1900.02013.65
5.4.20.1930.02113.67
5.4.10.2050.01813.54
5.4.00.1980.02513.40
5.3.290.1680.02012.60
5.3.280.1780.02212.59
5.3.270.1630.02212.60
5.3.260.1890.01912.61
5.3.250.1830.02312.56
5.3.240.1920.02712.56
5.3.230.1640.01912.59
5.3.220.1650.02312.57
5.3.210.1690.01612.46
5.3.200.1460.02312.44
5.3.190.1900.02212.49
5.3.180.1650.01912.72
5.3.170.2120.02012.56
5.3.160.1770.02212.68
5.3.150.1910.01812.55
5.3.140.1670.02312.60
5.3.130.2000.02712.46
5.3.120.2130.01812.44
5.3.110.1930.02312.52
5.3.100.2110.02012.22
5.3.90.1970.01812.35
5.3.80.2110.02312.32
5.3.70.1810.01912.25
5.3.60.1700.02012.33
5.3.50.1730.02012.27
5.3.40.0080.02612.42
5.3.30.0340.02512.31
5.3.20.1830.01811.99
5.3.10.1700.02112.03
5.3.00.2080.02312.12
5.2.170.1450.01710.16
5.2.160.0050.03110.19
5.2.150.0020.03810.22
5.2.140.1390.02110.23
5.2.130.1420.02010.32
5.2.120.1630.01710.25
5.2.110.1780.01610.17
5.2.100.1900.01310.21
5.2.90.1750.01710.23
5.2.80.1540.01710.21
5.2.70.1340.01710.16
5.2.60.1330.01810.23
5.2.50.1550.01710.20
5.2.40.1180.01810.12
5.2.30.1370.01510.18
5.2.20.1280.01710.18
5.2.10.1270.01810.14
5.2.00.1130.01810.03
5.1.60.1270.0149.74
5.1.50.1400.0159.71
5.1.40.0070.0249.60
5.1.30.0030.0229.89
5.1.20.0030.0269.87
5.1.10.0050.0289.75
5.1.00.0700.0199.72
5.0.50.0850.0109.02
5.0.40.0870.0158.93
5.0.30.0780.0188.78
5.0.20.0770.0148.85
5.0.10.0370.0138.82
5.0.00.0570.0178.75
4.4.90.0650.0077.61
4.4.80.0630.0107.61
4.4.70.0580.0107.56
4.4.60.0580.0087.59
4.4.50.0700.0137.60
4.4.40.0800.0177.61
4.4.30.0570.0147.62
4.4.20.0020.0197.63
4.4.10.0880.0087.63
4.4.00.0780.0137.59
4.3.110.0800.0137.62
4.3.100.0700.0097.57
4.3.90.0600.0107.59
4.3.80.0620.0167.55
4.3.70.0670.0087.55
4.3.60.0560.0097.60
4.3.50.0630.0107.60
4.3.40.0630.0147.57
4.3.30.0280.0117.31
4.3.20.0350.0137.31
4.3.10.0300.0097.31
4.3.00.0280.0107.31

preferences:
48.67 ms | 401 KiB | 5 Q