3v4l.org

run code in 300+ PHP versions simultaneously
<?php $weight = array('Galeria' => 4, 'Rss' => 3, 'Grande' => 2, 'Mediana' => 1); //$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.0130.00718.56
8.3.50.0130.00721.88
8.3.40.0000.01518.88
8.3.30.0130.00319.11
8.3.20.0070.00020.21
8.3.10.0040.00423.66
8.3.00.0080.00022.52
8.2.180.0100.00716.63
8.2.170.0060.01222.96
8.2.160.0070.00722.13
8.2.150.0040.00424.18
8.2.140.0040.01124.66
8.2.130.0080.00026.16
8.2.120.0050.00221.04
8.2.110.0070.00322.27
8.2.100.0040.00817.72
8.2.90.0050.00319.20
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0000.00817.93
8.2.50.0050.00318.07
8.2.40.0080.00018.22
8.2.30.0040.00418.00
8.2.20.0040.00417.75
8.2.10.0000.00717.87
8.2.00.0080.00017.85
8.1.280.0060.01525.92
8.1.270.0070.00023.93
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0060.00323.79
8.1.230.0030.00718.99
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0030.00717.35
8.1.190.0080.00017.41
8.1.180.0040.00418.10
8.1.170.0040.00418.61
8.1.160.0000.00821.91
8.1.150.0040.00418.70
8.1.140.0040.00417.43
8.1.130.0000.00717.82
8.1.120.0040.00417.50
8.1.110.0000.00817.49
8.1.100.0040.00417.51
8.1.90.0030.00517.49
8.1.80.0000.00717.50
8.1.70.0000.00717.46
8.1.60.0060.00317.56
8.1.50.0040.00417.56
8.1.40.0000.00817.45
8.1.30.0040.00417.63
8.1.20.0000.00817.57
8.1.10.0000.00717.50
8.1.00.0030.00617.46
8.0.300.0050.00218.77
8.0.290.0040.00417.01
8.0.280.0030.00318.48
8.0.270.0080.00017.28
8.0.260.0030.00316.78
8.0.250.0030.00317.11
8.0.240.0040.00416.93
8.0.230.0070.00017.00
8.0.220.0030.00317.03
8.0.210.0070.00016.95
8.0.200.0030.00317.02
8.0.190.0000.00717.07
8.0.180.0000.00717.01
8.0.170.0050.00317.07
8.0.160.0000.00716.86
8.0.150.0000.00816.88
8.0.140.0000.00816.93
8.0.130.0060.00013.40
8.0.120.0080.00016.87
8.0.110.0090.00017.00
8.0.100.0080.00017.00
8.0.90.0070.00016.86
8.0.80.0090.00616.97
8.0.70.0040.00416.97
8.0.60.0000.00717.00
8.0.50.0040.00416.98
8.0.30.0120.01317.17
8.0.20.0110.00817.40
8.0.10.0000.00717.11
8.0.00.0080.01316.87
7.4.330.0000.00515.20
7.4.320.0030.00316.67
7.4.300.0000.00616.39
7.4.290.0030.00316.65
7.4.280.0040.00416.50
7.4.270.0000.00816.62
7.4.260.0000.00716.59
7.4.250.0040.00416.39
7.4.240.0000.00716.59
7.4.230.0020.00516.48
7.4.220.0040.01516.47
7.4.210.0060.00816.60
7.4.200.0000.00716.71
7.4.190.0040.00416.38
7.4.160.0150.00316.47
7.4.150.0080.01117.40
7.4.140.0060.01317.86
7.4.130.0050.01416.63
7.4.120.0080.01016.57
7.4.110.0120.00516.34
7.4.100.0110.00616.43
7.4.90.0070.01316.43
7.4.80.0090.01216.84
7.4.70.0060.01616.68
7.4.60.0080.00816.65
7.4.50.0000.00816.25
7.4.40.0060.00922.77
7.4.30.0100.00716.57
7.4.00.0100.00614.94
7.3.330.0030.00313.46
7.3.320.0020.00213.18
7.3.310.0030.00316.38
7.3.300.0000.00716.38
7.3.290.0070.00716.35
7.3.280.0130.00616.41
7.3.270.0170.00717.40
7.3.260.0160.00716.71
7.3.250.0130.00616.51
7.3.240.0140.00716.60
7.3.230.0060.01216.39
7.3.210.0130.00516.50
7.3.200.0110.00719.39
7.3.190.0090.00916.45
7.3.180.0070.01016.44
7.3.170.0120.00316.49
7.3.160.0100.00616.43
7.3.120.0050.01115.02
7.3.110.0000.01014.81
7.3.100.0060.00914.77
7.3.90.0040.01214.91
7.3.80.0060.00314.52
7.3.70.0040.01114.94
7.3.60.0040.01114.96
7.3.50.0030.01014.83
7.3.40.0130.00014.85
7.3.30.0070.00714.78
7.3.20.0140.00316.70
7.3.10.0100.00316.49
7.3.00.0000.01716.69
7.2.330.0120.00616.72
7.2.320.0060.01516.62
7.2.310.0100.01016.65
7.2.300.0060.01016.64
7.2.290.0120.00316.80
7.2.250.0120.00615.03
7.2.240.0100.01014.96
7.2.230.0060.01215.27
7.2.220.0070.00714.95
7.2.210.0090.00615.07
7.2.200.0090.00314.82
7.2.190.0060.01015.15
7.2.180.0040.01114.96
7.2.170.0090.00614.96
7.2.00.0180.00919.16
7.1.330.0030.01215.48
7.1.320.0070.00715.83
7.1.310.0000.00915.85
7.1.300.0090.00315.71
7.1.290.0030.01015.77
7.1.280.0030.01015.89
7.1.270.0060.00615.84
7.1.260.0120.00016.04
7.1.100.0060.00918.21
7.1.70.0000.01017.16
7.1.60.0160.01019.24
7.1.50.0090.00917.02
7.1.00.0070.07322.32
7.0.200.0070.01016.61
7.0.140.0030.07322.07
7.0.100.0000.05720.04
7.0.90.0030.04319.97
7.0.80.0070.05720.00
7.0.70.0070.06319.96
7.0.60.0130.07319.94
7.0.50.0230.05720.31
7.0.40.0130.04320.15
7.0.30.0130.03720.11
7.0.20.0070.05319.99
7.0.10.0030.05019.95
7.0.00.0100.05020.08
5.6.280.0100.06721.13
5.6.250.0070.04020.60
5.6.240.0000.04720.64
5.6.230.0100.04320.63
5.6.220.0030.05320.67
5.6.210.0100.06720.65
5.6.200.0070.07021.09
5.6.190.0030.06020.97
5.6.180.0070.04721.07
5.6.170.0070.05321.01
5.6.160.0030.05321.03
5.6.150.0030.04721.18
5.6.140.0070.04321.06
5.6.130.0100.07321.17
5.6.120.0070.04021.08
5.6.110.0030.06021.06
5.6.100.0100.05021.07
5.6.90.0000.06021.03
5.6.80.0030.06320.41
5.6.70.0130.06720.45
5.6.60.0030.05320.51
5.6.50.0100.05720.40
5.6.40.0000.06020.45
5.6.30.0100.07720.48
5.6.20.0200.06320.38
5.6.10.0070.07720.52
5.6.00.0070.04320.52
5.5.380.0030.04020.43
5.5.370.0000.04720.46
5.5.360.0070.08720.56
5.5.350.0000.04720.43
5.5.340.0070.05320.76
5.5.330.0030.04720.91
5.5.320.0030.04320.94
5.5.310.0070.04020.83
5.5.300.0100.06720.81
5.5.290.0170.04720.89
5.5.280.0030.05020.84
5.5.270.0100.07320.76
5.5.260.0100.07320.73
5.5.250.0100.04320.71
5.5.240.0100.05320.32
5.5.230.0100.04720.31
5.5.220.0030.05320.18
5.5.210.0070.04020.23
5.5.200.0000.04320.13
5.5.190.0100.06720.00
5.5.180.0030.08720.11
5.5.160.0100.08320.20
5.5.150.0130.07320.16
5.5.140.0070.04320.24
5.5.130.0100.06720.11
5.5.120.0130.07020.14
5.5.110.0030.04020.14
5.5.100.0030.08320.18
5.5.90.0130.04720.11
5.5.80.0130.03320.18
5.5.70.0000.04719.97
5.5.60.0030.04720.16
5.5.50.0070.04320.11
5.5.40.0000.04320.03
5.5.30.0000.04320.04
5.5.20.0000.04719.93
5.5.10.0130.05020.13
5.5.00.0030.04319.96
5.4.450.0100.05019.51
5.4.440.0070.04019.47
5.4.430.0070.07319.36
5.4.420.0030.05019.35
5.4.410.0030.06719.22
5.4.400.0000.06319.18
5.4.390.0000.07719.17
5.4.380.0070.07719.07
5.4.370.0030.06018.90
5.4.360.0000.04719.13
5.4.350.0030.04719.14
5.4.340.0030.04019.16
5.4.320.0100.06719.09
5.4.310.0070.04719.05
5.4.300.0070.04719.02
5.4.290.0100.07018.90
5.4.280.0030.05718.89
5.4.270.0030.04719.14
5.4.260.0000.04319.06
5.4.250.0030.06719.05
5.4.240.0070.03718.84
5.4.230.0070.04019.12
5.4.220.0030.04319.15
5.4.210.0070.04019.15
5.4.200.0070.05319.15
5.4.190.0000.04319.04
5.4.180.0170.07018.89
5.4.170.0000.04719.22
5.4.160.0030.04019.21
5.4.150.0070.05718.85
5.4.140.0030.04016.48
5.4.130.0070.06316.48
5.4.120.0100.03016.37
5.4.110.0070.06016.41
5.4.100.0030.04016.40
5.4.90.0030.03716.45
5.4.80.0030.05016.54
5.4.70.0100.03016.31
5.4.60.0030.04016.25
5.4.50.0030.05716.39
5.4.40.0000.05716.50
5.4.30.0070.04016.38
5.4.20.0030.04016.32
5.4.10.0030.03716.47
5.4.00.0030.03715.87
5.3.290.0100.03314.73
5.3.280.0000.06014.57
5.3.270.0030.05014.54
5.3.260.0070.04714.75
5.3.250.0030.04714.61
5.3.240.0100.05714.68
5.3.230.0030.06014.67
5.3.220.0100.05714.53
5.3.210.0130.03714.72
5.3.200.0100.04714.50
5.3.190.0000.05014.51
5.3.180.0070.03314.53
5.3.170.0030.06314.50
5.3.160.0100.03714.54
5.3.150.0070.04014.70
5.3.140.0030.05314.54
5.3.130.0000.04714.48
5.3.120.0000.04314.51
5.3.110.0130.04314.65
5.3.100.0070.05313.98
5.3.90.0030.03714.05
5.3.80.0070.03714.02
5.3.70.0000.04314.08
5.3.60.0030.03714.10
5.3.50.0030.05014.01
5.3.40.0000.04713.93
5.3.30.0070.04313.82
5.3.20.0030.06013.76
5.3.10.0070.03713.68
5.3.00.0070.03313.64
5.2.170.0070.03311.16
5.2.160.0000.03311.20
5.2.150.0100.02311.01
5.2.140.0030.03310.98
5.2.130.0030.05011.05
5.2.120.0030.03711.17
5.2.110.0000.03010.96
5.2.100.0030.02711.09
5.2.90.0030.05311.17
5.2.80.0030.03010.88
5.2.70.0070.03711.09
5.2.60.0030.03011.07
5.2.50.0070.02710.94
5.2.40.0070.02710.99
5.2.30.0000.03310.97
5.2.20.0000.03310.95
5.2.10.0030.03010.81
5.2.00.0030.02710.76
5.1.60.0100.05310.66
5.1.50.0030.02710.66
5.1.40.0000.02710.66
5.1.30.0000.03010.66
5.1.20.0000.02710.66
5.1.10.0000.02710.66
5.1.00.0000.02310.66
5.0.50.0000.01710.66
5.0.40.0000.01710.66
5.0.30.0000.03010.66
5.0.20.0000.02010.66
5.0.10.0000.01710.66
5.0.00.0030.02310.66
4.4.90.0000.02010.66
4.4.80.0070.01310.66
4.4.70.0000.02010.66
4.4.60.0030.01310.66
4.4.50.0030.01310.66
4.4.40.0030.02310.66
4.4.30.0030.01710.66
4.4.20.0000.01310.66
4.4.10.0000.01710.66
4.4.00.0000.02710.66
4.3.110.0030.01010.66
4.3.100.0000.01310.66
4.3.90.0030.01310.66
4.3.80.0000.02010.66
4.3.70.0000.03010.66
4.3.60.0000.01310.66
4.3.50.0000.01710.66
4.3.40.0000.02710.66
4.3.30.0000.02710.66
4.3.20.0000.02010.66
4.3.10.0000.01710.66
4.3.00.0030.01310.66

preferences:
45.3 ms | 401 KiB | 5 Q