3v4l.org

run code in 300+ PHP versions simultaneously
<?php $weight = array('Galeria', 'Rss', 'Grande', 'Mediana'); echo array_search('Galeria', $weight); echo array_search('asd', $weight); die; //$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 $item . PHP_EOL; return (array_search($option, $weight) < array_search($item, $weight)) ? $option : $item; //return ($option > $item) ? $option : $item; }, 'Galeria'); 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.40.0040.01118.69
8.3.30.0100.00719.09
8.3.20.0000.00820.29
8.3.10.0080.00023.73
8.3.00.0060.00319.38
8.2.170.0170.00322.96
8.2.160.0100.00320.18
8.2.150.0000.00724.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0100.00022.12
8.2.110.0060.00322.24
8.2.100.0070.00717.65
8.2.90.0040.00419.17
8.2.80.0050.00317.97
8.2.70.0080.00317.63
8.2.60.0040.00417.68
8.2.50.0040.00418.07
8.2.40.0040.00419.91
8.2.30.0040.00418.14
8.2.20.0080.00017.83
8.2.10.0040.00417.95
8.2.00.0040.00417.67
8.1.270.0050.00323.79
8.1.260.0060.00326.35
8.1.250.0050.00228.09
8.1.240.0060.00323.87
8.1.230.0110.00019.04
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0090.00017.25
8.1.190.0060.00317.23
8.1.180.0000.01018.10
8.1.170.0050.00318.56
8.1.160.0000.00821.96
8.1.150.0040.00418.64
8.1.140.0000.00717.28
8.1.130.0070.00017.89
8.1.120.0050.00317.45
8.1.110.0000.00817.39
8.1.100.0030.00417.29
8.1.90.0030.00417.38
8.1.80.0040.00417.30
8.1.70.0030.00317.34
8.1.60.0040.00417.54
8.1.50.0040.00417.40
8.1.40.0040.00417.56
8.1.30.0070.00417.50
8.1.20.0040.00417.60
8.1.10.0070.00417.56
8.1.00.0050.00317.49
8.0.300.0070.00018.77
8.0.290.0050.00317.00
8.0.280.0070.00018.43
8.0.270.0030.00317.18
8.0.260.0000.00617.14
8.0.250.0030.00316.94
8.0.240.0060.00316.99
8.0.230.0000.00716.93
8.0.220.0020.00516.96
8.0.210.0070.00016.77
8.0.200.0030.00316.96
8.0.190.0000.00716.86
8.0.180.0100.00016.92
8.0.170.0040.00416.81
8.0.160.0030.00317.03
8.0.150.0070.00016.78
8.0.140.0000.00716.93
8.0.130.0000.00813.29
8.0.120.0000.00816.85
8.0.110.0070.00016.84
8.0.100.0000.00816.97
8.0.90.0040.00416.96
8.0.80.0100.00716.90
8.0.70.0050.00216.80
8.0.60.0000.00817.00
8.0.50.0000.00816.80
8.0.30.0100.00916.92
8.0.20.0060.01117.40
8.0.10.0050.00316.94
8.0.00.0060.01316.78
7.4.330.0020.00215.00
7.4.320.0000.00616.41
7.4.300.0000.00616.48
7.4.290.0040.00416.45
7.4.280.0000.00816.54
7.4.270.0000.00816.41
7.4.260.0030.00316.37
7.4.250.0000.00816.57
7.4.240.0030.00316.51
7.4.230.0030.00316.58
7.4.220.0150.00616.63
7.4.210.0100.00416.51
7.4.200.0000.00716.59
7.4.190.0000.00716.62
7.4.160.0160.00616.32
7.4.150.0050.01317.40
7.4.140.0140.00417.86
7.4.130.0090.01016.46
7.4.120.0090.00716.54
7.4.110.0120.00616.56
7.4.100.0110.01116.38
7.4.90.0070.01016.52
7.4.80.0150.00619.39
7.4.70.0060.00916.41
7.4.60.0060.01316.41
7.4.50.0020.00216.42
7.4.40.0030.01416.39
7.4.30.0100.00616.43
7.4.00.0070.01014.86
7.3.330.0000.00613.18
7.3.320.0000.00513.18
7.3.310.0000.00716.16
7.3.300.0060.00016.28
7.3.290.0070.01316.23
7.3.280.0120.00516.26
7.3.270.0070.01017.40
7.3.260.0120.00616.46
7.3.250.0090.00916.35
7.3.240.0140.00316.53
7.3.230.0070.02016.39
7.3.210.0070.01416.43
7.3.200.0150.00319.39
7.3.190.0070.01316.41
7.3.180.0040.01216.33
7.3.170.0060.00916.45
7.3.160.0060.00916.36
7.3.120.0140.00314.79
7.2.330.0070.01016.61
7.2.320.0040.01216.54
7.2.310.0030.01416.63
7.2.300.0100.01016.45
7.2.290.0120.00616.62
7.2.60.0070.00316.52
7.2.00.0190.00818.92
7.1.200.0060.00615.67
7.1.100.0030.01317.83
7.1.70.0000.00716.96
7.1.60.0140.01019.46
7.1.50.0030.02016.84
7.1.00.0030.07722.30
7.0.200.0040.00416.89
7.0.140.0000.07322.12
7.0.70.0130.07321.67
7.0.60.0130.07321.77
7.0.50.0130.08022.06
7.0.40.0100.07320.12
7.0.30.0100.08720.10
7.0.20.0070.07720.10
7.0.10.0030.08320.16
7.0.00.0100.08020.07
5.6.280.0000.07721.13
5.6.210.0000.08020.61
5.6.200.0130.08021.09
5.6.190.0070.08721.06
5.6.180.0100.07021.03
5.6.170.0130.07721.14
5.6.160.0070.08321.11
5.6.150.0070.08321.07
5.6.140.0100.08021.01
5.6.130.0100.08021.14
5.6.120.0130.07321.07
5.6.110.0070.08321.04
5.6.100.0070.06021.00
5.6.90.0030.08720.94
5.6.80.0100.07720.41
5.6.70.0170.07320.46
5.6.60.0070.08020.45
5.6.50.0070.08320.34
5.6.40.0030.08720.51
5.6.30.0100.07020.50
5.6.20.0030.05020.40
5.6.10.0130.06720.49
5.6.00.0030.08020.42
5.5.350.0130.07320.29
5.5.340.0170.08320.60
5.5.330.0070.08320.60
5.5.320.0130.07720.92
5.5.310.0030.08720.78
5.5.300.0030.08020.78
5.5.290.0070.08020.64
5.5.280.0100.08320.92
5.5.270.0130.07320.86
5.5.260.0070.06020.90
5.5.250.0030.08720.74
5.5.240.0030.08020.25
5.5.230.0170.07020.14
5.5.220.0130.06720.31
5.5.210.0070.08320.18
5.5.200.0100.07720.29
5.5.190.0100.08019.95
5.5.180.0000.04720.20
5.5.160.0030.09020.13
5.5.150.0070.07320.26
5.5.140.0070.07720.22
5.5.130.0030.05720.21
5.5.120.0070.07320.25
5.5.110.0030.06019.99
5.5.100.0070.08020.10
5.5.90.0030.08020.05
5.5.80.0100.07020.11
5.5.70.0100.07020.13
5.5.60.0030.08020.01
5.5.50.0130.06720.06
5.5.40.0100.07320.12
5.5.30.0030.07320.09
5.5.20.0130.07020.16
5.5.10.0030.07020.01
5.5.00.0070.08320.00
5.4.450.0030.06719.56
5.4.440.0100.07719.42
5.4.430.0030.08019.34
5.4.420.0030.08019.38
5.4.410.0070.07719.29
5.4.400.0030.07019.04
5.4.390.0100.07318.94
5.4.380.0100.06019.02
5.4.370.0070.07319.11
5.4.360.0100.07319.18
5.4.350.0000.08319.12
5.4.340.0070.07019.12
5.4.320.0070.07318.85
5.4.310.0000.08019.02
5.4.300.0000.07319.04
5.4.290.0000.07318.84
5.4.280.0000.06719.05
5.4.270.0130.04719.02
5.4.260.0030.05318.93
5.4.250.0030.07019.11
5.4.240.0000.07718.89
5.4.230.0130.07019.08
5.4.220.0100.06019.08
5.4.210.0000.07719.11
5.4.200.0000.06019.05
5.4.190.0130.07719.13
5.4.180.0030.08018.88
5.4.170.0000.08719.04
5.4.160.0100.07719.01
5.4.150.0070.07718.92
5.4.140.0000.08016.19
5.4.130.0000.05016.33
5.4.120.0030.07716.35
5.4.110.0030.06016.41
5.4.100.0070.06716.56
5.4.90.0030.07316.44
5.4.80.0070.06316.45
5.4.70.0000.05316.52
5.4.60.0070.06716.32
5.4.50.0030.08016.29
5.4.40.0070.07316.49
5.4.30.0030.07316.48
5.4.20.0030.06016.45
5.4.10.0070.06316.45
5.4.00.0000.07315.85
5.3.290.0100.07314.79
5.3.280.0030.06314.66
5.3.270.0100.06714.54
5.3.260.0070.07014.60
5.3.250.0000.07314.67
5.3.240.0070.04014.66
5.3.230.0030.07714.67
5.3.220.0000.07714.58
5.3.210.0000.08014.58
5.3.200.0000.08314.63
5.3.190.0000.07714.50
5.3.180.0070.06014.68
5.3.170.0030.07314.60
5.3.160.0030.07714.68
5.3.150.0030.05314.69
5.3.140.0030.07714.68
5.3.130.0070.07714.66
5.3.120.0030.07714.58
5.3.110.0070.06714.69
5.3.100.0030.05014.04
5.3.90.0100.07014.07
5.3.80.0030.07314.11
5.3.70.0100.07014.03
5.3.60.0030.06314.14
5.3.50.0030.07714.09
5.3.40.0070.07314.09
5.3.30.0030.07713.84
5.3.20.0000.07013.79
5.3.10.0070.07013.58
5.3.00.0030.06713.73
5.2.170.0000.06011.07
5.2.160.0130.04711.18
5.2.150.0070.05711.06
5.2.140.0070.05711.16
5.2.130.0100.05011.15
5.2.120.0000.06311.09
5.2.110.0030.06310.96
5.2.100.0030.06011.09
5.2.90.0030.06310.89
5.2.80.0000.05310.93
5.2.70.0000.05711.16
5.2.60.0000.05011.04
5.2.50.0100.05711.00
5.2.40.0030.05710.94
5.2.30.0030.04711.01
5.2.20.0070.04711.00
5.2.10.0030.03010.91
5.2.00.0000.03010.77
5.1.60.0070.02310.04
5.1.50.0030.0339.98
5.1.40.0000.0279.96
5.1.30.0000.03010.36
5.1.20.0030.02310.40
5.1.10.0030.02310.13
5.1.00.0000.02710.10
5.0.50.0000.0208.38
5.0.40.0000.0208.26
5.0.30.0000.0308.06
5.0.20.0030.0208.26
5.0.10.0000.0208.23
5.0.00.0030.0278.16
4.4.90.0000.0305.79
4.4.80.0000.0305.81
4.4.70.0030.0375.80
4.4.60.0000.0235.77
4.4.50.0030.0175.79
4.4.40.0030.0535.82
4.4.30.0030.0135.83
4.4.20.0030.0135.80
4.4.10.0000.0135.80
4.4.00.0000.0235.85
4.3.110.0000.0175.73
4.3.100.0000.0135.71
4.3.90.0000.0135.73
4.3.80.0000.0235.72
4.3.70.0000.0135.68
4.3.60.0030.0105.73
4.3.50.0000.0135.71
4.3.40.0030.0175.61
4.3.30.0000.0135.31
4.3.20.0000.0175.32
4.3.10.0030.0135.32
4.3.00.0000.0135.32

preferences:
42.01 ms | 400 KiB | 5 Q