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) { // return (array_search($option, $weight) < array_search($item, $weight)) ? $option : $item; // }, 'Mediana'); $fotos = array(array('idAdjunto' => 1, 'tamano' => 'Grande'), array('idAdjunto' => 2, 'tamano'=> 'Galeria'), array('idAdjunto' => 3, 'tamano'=> 'Mediana')); $fotos = array_filter($fotos, function($foto) use ($weight) {return in_array($foto['tamano'], $weight);}); $foto = array_reduce($fotos, function(&$foto, $item) use ($weight) { var_dump($foto); die; return (array_search($foto['tamano'], $weight) < array_search($item['tamano'], $weight)) ? $foto : $item; }, 'Mediana'); 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.80
8.3.30.0090.00619.09
8.3.20.0040.00420.33
8.3.10.0040.00423.43
8.3.00.0080.00019.51
8.2.170.0150.00322.96
8.2.160.0070.00720.19
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0060.00626.16
8.2.120.0050.00222.21
8.2.110.0030.00621.92
8.2.100.0060.00617.91
8.2.90.0040.00419.30
8.2.80.0030.00617.97
8.2.70.0040.00417.50
8.2.60.0040.00417.93
8.2.50.0050.00518.07
8.2.40.0040.00418.34
8.2.30.0050.00218.20
8.2.20.0030.00717.82
8.2.10.0050.00318.00
8.2.00.0000.00717.82
8.1.270.0110.00722.07
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.98
8.1.230.0060.00619.07
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0040.00417.66
8.1.180.0040.00418.10
8.1.170.0050.00318.59
8.1.160.0000.00722.09
8.1.150.0040.00418.65
8.1.140.0000.00717.37
8.1.130.0000.00717.74
8.1.120.0040.00417.37
8.1.110.0050.00217.35
8.1.100.0000.00817.38
8.1.90.0040.00417.50
8.1.80.0040.00417.49
8.1.70.0040.00417.43
8.1.60.0000.00817.49
8.1.50.0030.00617.55
8.1.40.0040.00417.48
8.1.30.0000.01117.61
8.1.20.0050.00317.62
8.1.10.0040.00417.55
8.1.00.0050.00317.46
8.0.300.0070.00018.77
8.0.290.0070.00017.05
8.0.280.0030.00318.37
8.0.270.0050.00317.35
8.0.260.0000.00716.77
8.0.250.0030.00317.04
8.0.240.0000.00717.04
8.0.230.0030.00316.98
8.0.220.0030.00316.88
8.0.210.0070.00016.89
8.0.200.0000.00616.90
8.0.190.0030.00616.99
8.0.180.0060.00616.95
8.0.170.0040.00416.89
8.0.160.0000.00717.01
8.0.150.0040.00416.90
8.0.140.0000.00716.97
8.0.130.0000.00613.36
8.0.120.0030.00516.82
8.0.110.0030.00616.92
8.0.100.0000.00817.07
8.0.90.0080.00016.91
8.0.80.0090.00617.00
8.0.70.0050.00316.85
8.0.60.0040.00416.85
8.0.50.0000.00716.87
8.0.30.0120.00717.26
8.0.20.0060.01417.40
8.0.10.0040.00417.07
8.0.00.0120.00716.97
7.4.330.0030.00315.00
7.4.320.0000.00616.42
7.4.300.0040.00416.59
7.4.290.0030.00316.59
7.4.280.0030.00316.49
7.4.270.0000.00716.62
7.4.260.0000.00716.60
7.4.250.0020.00516.59
7.4.240.0000.00716.62
7.4.230.0020.00516.35
7.4.220.0060.01016.64
7.4.210.0070.00916.63
7.4.200.0030.00316.43
7.4.190.0040.00416.46
7.4.160.0090.00616.49
7.4.150.0110.00617.40
7.4.140.0150.00817.86
7.4.130.0070.01016.68
7.4.120.0090.00816.54
7.4.110.0030.01416.54
7.4.100.0070.01016.58
7.4.90.0170.00016.60
7.4.80.0040.01419.39
7.4.70.0070.01416.59
7.4.60.0130.01016.63
7.4.50.0080.00016.60
7.4.40.0070.00722.77
7.4.30.0040.01116.57
7.4.00.0040.01414.83
7.3.330.0030.00313.39
7.3.320.0030.00313.55
7.3.310.0040.00416.29
7.3.300.0030.00316.29
7.3.290.0140.00016.30
7.3.280.0120.00616.39
7.3.270.0110.00717.40
7.3.260.0140.00316.41
7.3.250.0090.00916.45
7.3.240.0140.00716.61
7.3.230.0100.00916.43
7.3.210.0140.00416.42
7.3.200.0120.00519.39
7.3.190.0070.01016.37
7.3.180.0050.01016.56
7.3.170.0130.01016.49
7.3.160.0060.01016.48
7.3.120.0070.01014.90
7.2.330.0070.01016.78
7.2.320.0150.00916.75
7.2.310.0060.01016.79
7.2.300.0100.01316.80
7.2.290.0030.01716.80
7.2.00.0090.01618.96
7.1.100.0060.00618.21
7.1.70.0040.00817.28
7.1.60.0130.00619.33
7.1.50.0070.01116.86
7.1.00.0130.06322.57
7.0.200.0040.00416.54
7.0.140.0070.07322.07
7.0.100.0100.07019.90
7.0.90.0230.08719.93
7.0.80.0230.05319.89
7.0.70.0270.08319.89
7.0.60.0270.05020.07
7.0.50.0130.06720.39
7.0.40.0070.04720.08
7.0.30.0000.06320.13
7.0.20.0030.08020.11
7.0.10.0100.07720.09
7.0.00.0100.08020.18
5.6.280.0070.07021.05
5.6.250.0100.07720.58
5.6.240.0070.08320.55
5.6.230.0130.08320.61
5.6.220.0070.08020.73
5.6.210.0200.06320.65
5.6.200.0100.08321.12
5.6.190.0130.07321.06
5.6.180.0170.03721.12
5.6.170.0070.07321.17
5.6.160.0130.08321.03
5.6.150.0170.07720.96
5.6.140.0070.08721.04
5.6.130.0170.07020.95
5.6.120.0130.08021.02
5.6.110.0030.07721.11
5.6.100.0130.04720.95
5.6.90.0000.06321.04
5.6.80.0130.07020.38
5.6.70.0130.07320.41
5.6.60.0100.08020.41
5.6.50.0030.07720.53
5.6.40.0070.04320.46
5.6.30.0030.05320.40
5.6.20.0200.07020.46
5.6.10.0030.08720.39
5.6.00.0070.05320.39
5.5.380.0170.07020.40
5.5.370.0000.06020.52
5.5.360.0100.08320.45
5.5.350.0030.06320.38
5.5.340.0170.07020.93
5.5.330.0030.07320.89
5.5.320.0130.07320.90
5.5.310.0100.05020.92
5.5.300.0130.07320.90
5.5.290.0000.07720.78
5.5.280.0100.06720.84
5.5.270.0170.07020.83
5.5.260.0170.07320.80
5.5.250.0100.07320.46
5.5.240.0070.08720.19
5.5.230.0030.08720.16
5.5.220.0070.07720.27
5.5.210.0130.05720.18
5.5.200.0030.09020.00
5.5.190.0130.07020.18
5.5.180.0030.06320.30
5.5.160.0030.08320.26
5.5.150.0070.07720.13
5.5.140.0070.07720.27
5.5.130.0000.05720.25
5.5.120.0100.04320.15
5.5.110.0130.07320.24
5.5.100.0100.08720.08
5.5.90.0030.06319.98
5.5.80.0100.07320.07
5.5.70.0100.06020.06
5.5.60.0030.08020.01
5.5.50.0030.06020.16
5.5.40.0070.07720.16
5.5.30.0030.07020.00
5.5.20.0070.08020.04
5.5.10.0100.06719.98
5.5.00.0100.07019.99
5.4.450.0200.03719.54
5.4.440.0030.07719.36
5.4.430.0100.07019.21
5.4.420.0000.08019.35
5.4.410.0100.07319.39
5.4.400.0200.07319.05
5.4.390.0070.08718.88
5.4.380.0100.04319.14
5.4.370.0100.06019.21
5.4.360.0000.06019.10
5.4.350.0130.06719.16
5.4.340.0130.07019.05
5.4.320.0070.07319.18
5.4.310.0030.07719.13
5.4.300.0130.07019.14
5.4.290.0070.06719.02
5.4.280.0070.05319.12
5.4.270.0130.05319.18
5.4.260.0070.06319.16
5.4.250.0100.07019.08
5.4.240.0070.07319.03
5.4.230.0130.07019.03
5.4.220.0030.08719.02
5.4.210.0130.07319.13
5.4.200.0030.07319.02
5.4.190.0070.08019.20
5.4.180.0130.06018.84
5.4.170.0030.06019.14
5.4.160.0100.05719.14
5.4.150.0100.07719.14
5.4.140.0070.07716.50
5.4.130.0030.07716.41
5.4.120.0100.07016.41
5.4.110.0130.06716.44
5.4.100.0030.07716.29
5.4.90.0100.07016.46
5.4.80.0070.07316.42
5.4.70.0100.06716.45
5.4.60.0070.07016.42
5.4.50.0000.05016.54
5.4.40.0030.07716.36
5.4.30.0070.04716.36
5.4.20.0100.05716.39
5.4.10.0100.04016.41
5.4.00.0100.06015.77
5.3.290.0070.07314.60
5.3.280.0070.07714.53
5.3.270.0030.07014.63
5.3.260.0100.03714.66
5.3.250.0000.04014.64
5.3.240.0100.06714.66
5.3.230.0100.06714.63
5.3.220.0130.07014.53
5.3.210.0100.07314.57
5.3.200.0170.06314.61
5.3.190.0100.06714.53
5.3.180.0070.05014.58
5.3.170.0070.07014.71
5.3.160.0070.07314.71
5.3.150.0100.06714.63
5.3.140.0070.07314.52
5.3.130.0100.07314.57
5.3.120.0030.05314.69
5.3.110.0130.06014.55
5.3.100.0070.05314.11
5.3.90.0070.04714.02
5.3.80.0100.07313.93
5.3.70.0030.07714.00
5.3.60.0100.07014.07
5.3.50.0070.07313.88
5.3.40.0000.08014.08
5.3.30.0000.07713.89
5.3.20.0000.05313.76
5.3.10.0000.04013.75
5.3.00.0070.07313.65
5.2.170.0070.06313.46
5.2.160.0070.06313.46
5.2.150.0070.05713.46
5.2.140.0100.06013.46
5.2.130.0100.05013.46
5.2.120.0000.06713.46
5.2.110.0030.04013.46
5.2.100.0070.06013.46
5.2.90.0130.05313.46
5.2.80.0030.06013.46
5.2.70.0100.03013.46
5.2.60.0000.05713.46
5.2.50.0070.05713.46
5.2.40.0070.03313.46
5.2.30.0030.05713.46
5.2.20.0070.05713.46
5.2.10.0000.06313.46
5.2.00.0100.05313.46
5.1.60.0030.04713.46
5.1.50.0000.04013.46
5.1.40.0000.04013.46
5.1.30.0030.04313.46
5.1.20.0000.03013.46
5.1.10.0070.03713.46
5.1.00.0000.05013.46
5.0.50.0030.04713.46
5.0.40.0030.03713.46
5.0.30.0000.04713.46
5.0.20.0100.03313.46
5.0.10.0000.03713.46
5.0.00.0030.03713.46
4.4.90.0070.03013.46
4.4.80.0030.02713.46
4.4.70.0030.03713.46
4.4.60.0030.03713.46
4.4.50.0000.03713.46
4.4.40.0100.04013.46
4.4.30.0070.03013.46
4.4.20.0000.03713.46
4.4.10.0030.03313.46
4.4.00.0100.04713.46
4.3.110.0000.03713.46
4.3.100.0000.03713.46
4.3.90.0030.03713.46
4.3.80.0030.03713.46
4.3.70.0000.03713.46
4.3.60.0070.02713.46
4.3.50.0070.03013.46
4.3.40.0000.05013.46
4.3.30.0000.02313.46
4.3.20.0000.01713.46
4.3.10.0000.03713.46
4.3.00.0030.02313.46

preferences:
44.1 ms | 400 KiB | 5 Q