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);}); var_dump($fotos); die; $foto = array_reduce($fotos, function(&$foto, $item) use ($weight) { 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.71
8.3.30.0080.00619.08
8.3.20.0040.00420.30
8.3.10.0080.00023.54
8.3.00.0080.00022.43
8.2.170.0090.00622.96
8.2.160.0090.00620.29
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0000.00722.30
8.2.110.0070.00322.12
8.2.100.0120.00017.84
8.2.90.0050.00317.97
8.2.80.0060.00317.97
8.2.70.0000.00817.63
8.2.60.0030.00617.93
8.2.50.0050.00318.07
8.2.40.0070.00018.34
8.2.30.0040.00418.25
8.2.20.0000.00817.70
8.2.10.0040.00419.47
8.2.00.0030.00617.78
8.1.270.0000.01523.91
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0090.00022.50
8.1.230.0080.00420.86
8.1.220.0000.00817.74
8.1.210.0040.00418.82
8.1.200.0070.00317.24
8.1.190.0040.00417.63
8.1.180.0000.00918.10
8.1.170.0000.00818.43
8.1.160.0040.00421.91
8.1.150.0050.00218.72
8.1.140.0030.00617.48
8.1.130.0000.00717.75
8.1.120.0000.00717.48
8.1.110.0000.00817.32
8.1.100.0040.00417.38
8.1.90.0040.00417.40
8.1.80.0030.00317.38
8.1.70.0000.00817.40
8.1.60.0040.00417.49
8.1.50.0000.00917.55
8.1.40.0050.00217.42
8.1.30.0000.00817.46
8.1.20.0050.00317.68
8.1.10.0000.00917.49
8.1.00.0000.00817.54
8.0.300.0000.00819.95
8.0.290.0040.00417.15
8.0.280.0000.00718.34
8.0.270.0050.00217.28
8.0.260.0000.00716.89
8.0.250.0060.00017.02
8.0.240.0040.00416.92
8.0.230.0050.00317.04
8.0.220.0040.00416.97
8.0.210.0030.00316.99
8.0.200.0030.00317.03
8.0.190.0000.00717.00
8.0.180.0040.00417.04
8.0.170.0080.00017.06
8.0.160.0040.00416.87
8.0.150.0000.00716.80
8.0.140.0050.00216.94
8.0.130.0000.00613.48
8.0.120.0050.00316.99
8.0.110.0040.00416.85
8.0.100.0070.00016.93
8.0.90.0040.00416.79
8.0.80.0130.00416.93
8.0.70.0040.00417.00
8.0.60.0000.00817.00
8.0.50.0040.00416.87
8.0.30.0120.00717.14
8.0.20.0100.01017.40
8.0.10.0040.00417.10
8.0.00.0090.01116.86
7.4.330.0000.00515.14
7.4.320.0070.00016.63
7.4.300.0000.00616.47
7.4.290.0070.00016.62
7.4.280.0070.00016.63
7.4.270.0030.00316.55
7.4.260.0070.00016.57
7.4.250.0030.00616.59
7.4.240.0030.00416.53
7.4.230.0030.00316.59
7.4.220.0200.00316.72
7.4.210.0040.01216.60
7.4.200.0050.00216.36
7.4.190.0080.00016.39
7.4.160.0100.00716.56
7.4.150.0100.01317.40
7.4.140.0070.01117.86
7.4.130.0130.00816.51
7.4.120.0090.00816.60
7.4.110.0120.00616.80
7.4.100.0150.00916.63
7.4.90.0210.00016.53
7.4.80.0160.00319.39
7.4.70.0080.01116.67
7.4.60.0120.00416.73
7.4.50.0030.00616.48
7.4.40.0060.00922.77
7.4.30.0090.00916.37
7.4.00.0100.00614.81
7.3.330.0020.00213.31
7.3.320.0000.00613.21
7.3.310.0050.00216.46
7.3.300.0030.00316.36
7.3.290.0120.00616.38
7.3.280.0020.01616.39
7.3.270.0040.01517.40
7.3.260.0120.01216.46
7.3.250.0080.01016.49
7.3.240.0090.01616.56
7.3.230.0040.01416.39
7.3.210.0070.01416.47
7.3.200.0120.00919.39
7.3.190.0160.00616.46
7.3.180.0110.00516.39
7.3.170.0080.00816.45
7.3.160.0120.00616.36
7.3.120.0100.00714.61
7.3.110.0060.01014.80
7.3.100.0000.00914.89
7.3.90.0030.01314.87
7.3.80.0060.00614.83
7.3.70.0040.01114.87
7.3.60.0030.01414.78
7.3.50.0000.01114.77
7.3.40.0040.01114.78
7.3.30.0070.00714.84
7.3.20.0000.01516.59
7.3.10.0050.00816.72
7.3.00.0070.00516.41
7.2.330.0090.00916.59
7.2.320.0110.00816.77
7.2.310.0100.00916.48
7.2.300.0060.01016.58
7.2.290.0060.01216.81
7.2.240.0070.01115.27
7.2.230.0070.01015.14
7.2.220.0130.00315.28
7.2.210.0000.01315.32
7.2.200.0100.00615.21
7.2.190.0040.01114.82
7.2.180.0080.00315.23
7.2.170.0100.00615.05
7.2.160.0100.00615.15
7.2.150.0000.01817.07
7.2.140.0070.00716.97
7.2.130.0080.00716.83
7.2.120.0060.01016.90
7.2.110.0050.00916.77
7.2.100.0030.00916.96
7.2.90.0090.00516.64
7.2.80.0060.00816.99
7.2.70.0080.00517.01
7.2.60.0110.00516.90
7.2.50.0080.00616.90
7.2.40.0030.00816.80
7.2.30.0050.01017.08
7.2.20.0060.00716.78
7.2.10.0040.01016.96
7.2.00.0070.00817.58
7.1.330.0030.01015.91
7.1.320.0000.01615.94
7.1.310.0100.00715.90
7.1.300.0000.01315.83
7.1.290.0030.01115.71
7.1.280.0060.00915.76
7.1.270.0040.01115.76
7.1.260.0090.00615.88
7.1.250.0060.00915.90
7.1.100.1270.01016.05
7.1.70.0080.00416.78
7.1.60.0170.00719.29
7.1.50.0200.01334.84
7.1.00.0000.07722.44
7.0.200.0100.00016.46
7.0.140.0070.06722.07
7.0.100.0100.07719.92
7.0.90.0130.04019.94
7.0.80.0130.07019.91
7.0.70.0100.08019.88
7.0.60.0130.07719.87
7.0.50.0100.08320.20
7.0.40.0070.08320.04
7.0.30.0030.07720.15
7.0.20.0170.08020.05
7.0.10.0200.07720.13
7.0.00.0070.06720.03
5.6.250.0100.07720.76
5.6.240.0100.08020.70
5.6.230.0100.06020.64
5.6.220.0200.07020.66
5.6.210.0100.06020.69
5.6.200.0000.08721.10
5.6.190.0000.08721.03
5.6.180.0170.06021.09
5.6.170.0070.08720.96
5.6.160.0070.08021.06
5.6.150.0030.05320.96
5.6.140.0030.06020.94
5.6.130.0030.08320.93
5.6.120.0000.04721.14
5.6.110.0030.04721.17
5.6.100.0030.04321.03
5.6.90.0100.03721.16
5.6.80.0030.04020.50
5.6.70.0070.05720.34
5.6.60.0030.05020.51
5.6.50.0100.04020.41
5.6.40.0070.03720.33
5.6.30.0030.04720.38
5.6.20.0130.03320.27
5.6.10.0030.04020.32
5.6.00.0030.04720.45
5.5.380.0130.07320.51
5.5.370.0100.08320.37
5.5.360.0070.07720.45
5.5.350.0070.06720.47
5.5.340.0070.07720.80
5.5.330.0100.07320.93
5.5.320.0170.07020.82
5.5.310.0100.08320.64
5.5.300.0100.03720.79
5.5.290.0000.04720.64
5.5.280.0030.04320.93
5.5.270.0030.04720.64
5.5.260.0070.04020.88
5.5.250.0070.03720.58
5.5.240.0030.08020.15
5.5.230.0100.07720.27
5.5.220.0100.07320.18
5.5.210.0000.08020.27
5.5.200.0030.04020.15
5.5.190.0070.04320.24
5.5.180.0000.04320.13
5.5.160.0070.07020.24
5.5.150.0070.04720.08
5.5.140.0170.03020.18
5.5.130.0030.05020.21
5.5.120.0030.04020.20
5.5.110.0070.04020.26
5.5.100.0100.03320.17
5.5.90.0130.03319.96
5.5.80.0100.03320.17
5.5.70.0070.07720.07
5.5.60.0100.06720.06
5.5.50.0070.03320.16
5.5.40.0030.03319.96
5.5.30.0070.04320.15
5.5.20.0100.03319.93
5.5.10.0030.04020.02
5.5.00.0100.03320.13
5.4.450.0070.03719.50
5.4.440.0030.04019.23
5.4.430.0100.03319.35
5.4.420.0100.03719.45
5.4.410.0070.03719.38
5.4.400.0000.08719.04
5.4.390.0070.07719.21
5.4.380.0200.06019.04
5.4.370.0000.05719.13
5.4.360.0070.06719.13
5.4.350.0030.04019.16
5.4.340.0000.04319.12
5.4.320.0030.04719.03
5.4.310.0130.03019.04
5.4.300.0070.06019.04
5.4.290.0070.03719.17
5.4.280.0100.03319.16
5.4.270.0130.03319.03
5.4.260.0030.04018.95
5.4.250.0070.03319.08
5.4.240.0030.03319.04
5.4.230.0070.04019.04
5.4.220.0000.03718.87
5.4.210.0000.03719.11
5.4.200.0030.03719.11
5.4.190.0030.03719.08
5.4.180.0030.03719.04
5.4.170.0130.03319.08
5.4.160.0030.03318.98
5.4.150.0000.04719.10
5.4.140.0170.01716.38
5.4.130.0070.03316.27
5.4.120.0070.05016.19
5.4.110.0030.06316.48
5.4.100.0070.06716.27
5.4.90.0030.07016.40
5.4.80.0030.04316.34
5.4.70.0070.06716.26
5.4.60.0070.07316.44
5.4.50.0030.07316.47
5.4.40.0100.06716.47
5.4.30.0170.06716.29
5.4.20.0030.06316.48
5.4.10.0070.07016.43
5.4.00.0100.05015.77
5.3.290.0030.04014.79
5.3.280.0070.03014.53
5.3.270.0030.04014.55
5.3.260.0070.03314.62
5.3.250.0000.03714.76
5.3.240.0100.05714.57
5.3.230.0030.04014.57
5.3.220.0070.03714.50
5.3.210.0000.04314.68
5.3.200.0070.07314.57
5.3.190.0130.07314.63
5.3.180.0070.07714.50
5.3.170.0100.06314.54
5.3.160.0100.06714.69
5.3.150.0000.08014.52
5.3.140.0100.07314.49
5.3.130.0170.06714.49
5.3.120.0100.07014.66
5.3.110.0100.07714.65
5.3.100.0100.06713.96
5.3.90.0130.05014.05
5.3.80.0100.06314.05
5.3.70.0030.07314.02
5.3.60.0100.07014.10
5.3.50.0100.06313.93
5.3.40.0070.07014.05
5.3.30.0000.08313.91
5.3.20.0030.07313.83
5.3.10.0000.07313.66
5.3.00.0100.07013.71
5.2.170.0100.06011.59
5.2.160.0070.06011.59
5.2.150.0030.06311.59
5.2.140.0130.05311.59
5.2.130.0070.05711.59
5.2.120.0070.05711.59
5.2.110.0000.06311.59
5.2.100.0130.05711.59
5.2.90.0030.05311.59
5.2.80.0130.06011.59
5.2.70.0030.06311.59
5.2.60.0070.06011.59
5.2.50.0070.05311.59
5.2.40.0070.06711.59
5.2.30.0070.05311.59
5.2.20.0070.05311.59
5.2.10.0100.05711.59
5.2.00.0030.06311.59
5.1.60.0030.05011.59
5.1.50.0070.05311.59
5.1.40.0070.05311.59
5.1.30.0100.05011.59
5.1.20.0030.05311.59
5.1.10.0000.05711.59
5.1.00.0070.05011.59
5.0.50.0070.04311.59
5.0.40.0070.04311.59
5.0.30.0030.03011.59
5.0.20.0030.04311.59
5.0.10.0100.03711.59
5.0.00.0030.04311.59
4.4.90.0000.03711.59
4.4.80.0030.03311.59
4.4.70.0000.04011.59
4.4.60.0000.03311.59
4.4.50.0030.03711.59
4.4.40.0030.05311.59
4.4.30.0030.02711.59
4.4.20.0030.02311.59
4.4.10.0000.03311.59
4.4.00.0030.04711.59
4.3.110.0030.03311.59
4.3.100.0000.03311.59
4.3.90.0030.02711.59
4.3.80.0030.05011.59
4.3.70.0000.02311.59
4.3.60.0000.03711.59
4.3.50.0030.02711.59
4.3.40.0000.04311.59
4.3.30.0030.03711.59
4.3.20.0030.03011.59
4.3.10.0000.03011.59
4.3.00.0030.03011.59

preferences:
42.82 ms | 400 KiB | 5 Q