3v4l.org

run code in 300+ PHP versions simultaneously
<?php $weight = array('Galeria' => 4, 'Rss' => 3, 'Grande' => 2, 'Mediana' => 1); var_dump($weight); 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.75
8.3.50.0130.00517.32
8.3.40.0090.00618.75
8.3.30.0150.00018.60
8.3.20.0040.00418.60
8.3.10.0030.00620.66
8.3.00.0040.00419.38
8.2.180.0070.01116.75
8.2.170.0090.00622.96
8.2.160.0060.01020.56
8.2.150.0050.00224.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00421.04
8.2.110.0000.00920.57
8.2.100.0080.00417.72
8.2.90.0040.00419.43
8.2.80.0000.00719.32
8.2.70.0080.00017.50
8.2.60.0050.00317.89
8.2.50.0000.00918.07
8.2.40.0000.00918.16
8.2.30.0050.00218.10
8.2.20.0070.00517.65
8.2.10.0060.00317.76
8.2.00.0030.00617.77
8.1.280.0100.00325.92
8.1.270.0080.00023.99
8.1.260.0060.00326.35
8.1.250.0000.00728.09
8.1.240.0100.00022.20
8.1.230.0090.00320.96
8.1.220.0090.00017.74
8.1.210.0050.00318.90
8.1.200.0090.00017.22
8.1.190.0080.00017.50
8.1.180.0080.00018.10
8.1.170.0000.00818.63
8.1.160.0050.00218.80
8.1.150.0050.00318.68
8.1.140.0040.00417.44
8.1.130.0040.00417.76
8.1.120.0040.00417.37
8.1.110.0040.00417.34
8.1.100.0000.00817.46
8.1.90.0000.00717.34
8.1.80.0000.00717.32
8.1.70.0000.00917.43
8.1.60.0040.00417.59
8.1.50.0040.00417.40
8.1.40.0040.00417.61
8.1.30.0000.00817.64
8.1.20.0030.00617.58
8.1.10.0000.00817.43
8.1.00.0000.00917.36
8.0.300.0000.00820.16
8.0.290.0040.00416.75
8.0.280.0030.00318.39
8.0.270.0030.00317.27
8.0.260.0040.00416.86
8.0.250.0000.00817.01
8.0.240.0040.00416.90
8.0.230.0040.00417.05
8.0.220.0030.00316.88
8.0.210.0060.00316.94
8.0.200.0060.00316.97
8.0.190.0040.00416.85
8.0.180.0050.00316.95
8.0.170.0040.00416.84
8.0.160.0030.00316.92
8.0.150.0020.00516.89
8.0.140.0050.00516.79
8.0.130.0000.00513.35
8.0.120.0000.00816.86
8.0.110.0040.00416.95
8.0.100.0040.00416.80
8.0.90.0050.00316.87
8.0.80.0040.01316.92
8.0.70.0070.00016.75
8.0.60.0020.00516.81
8.0.50.0000.00716.89
8.0.30.0110.00417.27
8.0.20.0110.01017.05
8.0.10.0040.00416.93
8.0.00.0130.00916.59
7.4.330.0050.00012.94
7.4.320.0040.00416.50
7.4.300.0030.00616.38
7.4.290.0030.00316.57
7.4.280.0070.00316.49
7.4.270.0070.00016.37
7.4.260.0000.00613.17
7.4.250.0030.00516.45
7.4.240.0040.00416.57
7.4.230.0070.00016.44
7.4.220.0070.01316.42
7.4.210.0120.00316.44
7.4.200.0030.00516.31
7.4.190.0070.00016.43
7.4.160.0080.00816.40
7.4.150.0030.01516.32
7.4.140.0100.00716.32
7.4.130.0030.01416.45
7.4.120.0110.00616.50
7.4.110.0060.01216.53
7.4.100.0110.01116.42
7.4.90.0090.00916.46
7.4.80.0090.00819.39
7.4.70.0000.01616.52
7.4.60.0160.00316.45
7.4.50.0080.00016.26
7.4.40.0060.00616.50
7.4.30.0150.00016.49
7.4.10.0170.00014.82
7.4.00.0100.00715.00
7.3.330.0000.00613.06
7.3.320.0050.00013.18
7.3.310.0030.00516.24
7.3.300.0030.00316.24
7.3.290.0080.00716.27
7.3.280.0100.01016.30
7.3.270.0140.00316.54
7.3.260.0130.00716.54
7.3.250.0120.00816.29
7.3.240.0100.00616.31
7.3.230.0030.01316.25
7.3.210.0050.01416.46
7.3.200.0100.00716.37
7.3.190.0100.00716.27
7.3.180.0140.00716.14
7.3.170.0030.01316.44
7.3.160.0140.00616.39
7.3.130.0120.00314.72
7.3.120.0060.00614.81
7.3.110.0040.01414.63
7.3.100.0100.00714.51
7.3.90.0030.01414.80
7.3.80.0030.00914.76
7.3.70.0030.01014.71
7.3.60.0090.00614.64
7.3.50.0090.00314.91
7.3.40.0100.00014.45
7.3.30.0030.01014.60
7.3.20.0070.01016.40
7.3.10.0080.00316.52
7.3.00.0060.00916.50
7.2.330.0100.00716.49
7.2.320.0130.00916.42
7.2.310.0060.01216.40
7.2.300.0030.01516.68
7.2.290.0100.00716.26
7.2.260.0000.01415.09
7.2.250.0070.01114.99
7.2.240.0070.00714.97
7.2.230.0160.00314.84
7.2.220.0070.01014.85
7.2.210.0040.00815.13
7.2.200.0100.00714.84
7.2.190.0030.01514.99
7.2.180.0060.00614.75
7.2.170.0060.00614.70
7.2.160.0060.01014.44
7.2.150.0040.00716.64
7.2.140.0050.00516.59
7.2.130.0160.00016.77
7.2.120.0060.00916.45
7.2.110.0040.00816.65
7.2.100.0070.00716.38
7.2.90.0110.00416.60
7.2.80.0030.01216.88
7.2.70.0100.00316.78
7.2.60.0040.01116.62
7.2.50.0070.00716.75
7.2.40.0000.01416.51
7.2.30.0030.00616.55
7.2.20.0040.01516.64
7.2.10.0040.00816.58
7.2.00.0040.01218.02
7.1.330.0090.00315.53
7.1.320.0100.00715.39
7.1.310.0030.00715.82
7.1.300.0100.00715.44
7.1.290.0060.00315.77
7.1.280.0040.01215.34
7.1.270.0000.01515.36
7.1.260.0030.00915.59
7.1.250.0000.01215.40
7.1.240.0030.01015.63
7.1.230.0030.00515.68
7.1.220.0100.00015.78
7.1.210.0030.00915.60
7.1.200.0040.01215.72
7.1.190.0040.00715.68
7.1.180.0060.00315.81
7.1.170.0030.01315.67
7.1.160.0000.01415.79
7.1.150.0030.00615.59
7.1.140.0040.01115.80
7.1.130.0030.01015.70
7.1.120.0100.00715.43
7.1.110.0140.00415.54
7.1.100.0060.00516.87
7.1.90.0040.01215.49
7.1.80.0110.00715.77
7.1.70.0080.00616.53
7.1.60.0050.01417.44
7.1.50.0060.00916.22
7.1.40.0000.01415.59
7.1.30.0000.01115.73
7.1.20.0040.01115.81
7.1.10.0130.00015.36
7.1.00.0090.01718.93
7.0.330.0000.00815.32
7.0.320.0060.00315.30
7.0.310.0060.00315.39
7.0.300.0000.01115.25
7.0.290.0100.00315.29
7.0.280.0150.00015.42
7.0.270.0030.00515.09
7.0.260.0040.01115.35
7.0.250.0000.00915.24
7.0.240.0060.00915.19
7.0.230.0040.01115.26
7.0.220.0030.01315.24
7.0.210.0060.00615.27
7.0.200.0030.00715.93
7.0.190.0060.00615.38
7.0.180.0030.00715.33
7.0.170.0100.00315.44
7.0.160.0110.00315.31
7.0.150.0100.00315.09
7.0.140.0050.03818.76
7.0.130.0030.00914.95
7.0.120.0050.04018.55
7.0.110.0000.01115.30
7.0.100.0070.00715.28
7.0.90.0040.00715.43
7.0.80.0040.01115.34
7.0.70.0030.00614.96
7.0.60.0070.03717.62
7.0.50.0050.03216.62
7.0.40.0070.04316.81
7.0.30.0150.02616.75
7.0.20.0160.04116.76
7.0.10.0190.03916.84
7.0.00.0070.04416.84
5.6.400.0000.01514.26
5.6.390.0040.00714.26
5.6.380.0100.00714.48
5.6.370.0030.00614.47
5.6.360.0040.01114.04
5.6.350.0000.00814.27
5.6.340.0080.00814.13
5.6.330.0000.00914.04
5.6.320.0030.00914.23
5.6.310.0110.00413.96
5.6.300.0060.00814.36
5.6.290.0030.01214.30
5.6.280.0050.04217.65
5.6.270.0040.01414.59
5.6.260.0030.01214.54
5.6.250.0060.00314.28
5.6.240.0030.01314.39
5.6.230.0150.00414.17
5.6.220.0070.00314.31
5.6.210.0050.04317.42
5.6.200.0070.02316.25
5.6.190.0080.02417.32
5.6.180.0170.04517.34
5.6.170.0070.03817.49
5.6.160.0020.02917.42
5.6.150.0050.02616.24
5.6.140.0080.04316.34
5.6.130.0060.03116.18
5.6.120.0120.03817.57
5.6.110.0030.02517.56
5.6.100.0110.04017.48
5.6.90.0080.04617.61
5.6.80.0030.04817.22
5.6.70.0150.02217.32
5.6.60.0030.01013.95
5.6.50.0030.01014.02
5.6.40.0100.00314.19
5.6.30.0000.01214.07
5.6.20.0120.00014.35
5.6.10.0070.00714.28
5.6.00.0060.01214.32
5.5.380.0070.00314.04
5.5.370.0040.01114.32
5.5.360.0060.00613.78
5.5.350.0210.03817.44
5.5.340.0050.03515.93
5.5.330.0070.03017.37
5.5.320.0100.04717.28
5.5.310.0080.03117.26
5.5.300.0030.03816.21
5.5.290.0020.04815.94
5.5.280.0050.03417.52
5.5.270.0080.04517.42
5.5.260.0080.02817.33
5.5.250.0030.03517.36
5.5.240.0090.04317.23
5.5.230.0030.01013.79
5.5.220.0080.00314.20
5.5.210.0070.00713.96
5.5.200.0090.00614.04
5.5.190.0000.01413.96
5.5.180.0040.01213.89
5.5.170.0070.00714.05
5.5.160.0080.00413.88
5.5.150.0100.00713.82
5.5.140.0040.00714.01
5.5.130.0030.00614.03
5.5.120.0000.01314.21
5.5.110.0090.00614.13
5.5.100.0120.00314.20
5.5.90.0030.00614.19
5.5.80.0030.00614.04
5.5.70.0070.00714.06
5.5.60.0040.00414.12
5.5.50.0070.00714.23
5.5.40.0070.01013.80
5.5.30.0030.00814.21
5.5.20.0090.00613.74
5.5.10.0030.01214.05
5.5.00.0030.01014.05
5.4.450.0030.02515.34
5.4.440.0010.02815.29
5.4.430.0020.02315.27
5.4.420.0050.02015.20
5.4.410.0030.02215.07
5.4.400.0030.02215.04
5.4.390.0030.02215.13
5.4.380.0050.02015.11
5.4.370.0060.01815.10
5.4.360.0040.02215.01
5.4.350.0040.02514.99
5.4.340.0050.02015.04
5.4.330.0030.00511.10
5.4.320.0070.02015.17
5.4.310.0030.02215.04
5.4.300.0060.04015.01
5.4.290.0060.04215.17
5.4.280.0080.04115.12
5.4.270.0050.03114.98
5.4.260.0030.02715.13
5.4.250.0070.03014.98
5.4.240.0040.02414.98
5.4.230.0080.03815.17
5.4.220.0030.03115.12
5.4.210.0090.02815.04
5.4.200.0050.04315.11
5.4.190.0090.03415.17
5.4.180.0050.02515.21
5.4.170.0020.02515.16
5.4.160.0070.02115.12
5.4.150.0050.03315.03
5.4.140.0090.03313.81
5.4.130.0020.04213.84
5.4.120.0070.02313.69
5.4.110.0020.04013.72
5.4.100.0040.02613.75
5.4.90.0080.04013.91
5.4.80.0020.02713.78
5.4.70.0070.03513.81
5.4.60.0050.04013.77
5.4.50.0090.03913.79
5.4.40.0080.03513.74
5.4.30.0100.03013.76
5.4.20.0100.03613.68
5.4.10.0110.02113.78
5.4.00.0100.03213.47
5.3.290.0050.02312.89
5.3.280.0070.04012.93
5.3.270.0080.03212.86
5.3.260.0020.04612.86
5.3.250.0120.03512.88
5.3.240.0070.03612.86
5.3.230.0020.04412.93
5.3.220.0010.02912.85
5.3.210.0040.04412.86
5.3.200.0070.03512.85
5.3.190.0090.01812.91
5.3.180.0050.03412.80
5.3.170.0070.03812.79
5.3.160.0070.04012.85
5.3.150.0020.03212.86
5.3.140.0090.04312.87
5.3.130.0130.03712.84
5.3.120.0090.03712.83
5.3.110.0020.02612.83
5.3.100.0020.04812.52
5.3.90.0080.03212.64
5.3.80.0050.02212.56
5.3.70.0100.03012.56
5.3.60.0070.03812.55
5.3.50.0050.04012.57
5.3.40.0020.04412.52
5.3.30.0070.03312.52
5.3.20.0050.02312.38
5.3.10.0040.04012.38
5.3.00.0100.03312.39
5.2.170.0070.06311.16
5.2.160.0070.05311.07
5.2.150.0030.06311.09
5.2.140.0070.06310.97
5.2.130.0100.05711.04
5.2.120.0070.05011.11
5.2.110.0100.02711.05
5.2.100.0030.03710.92
5.2.90.0070.06011.03
5.2.80.0070.05710.99
5.2.70.0070.05711.00
5.2.60.0070.06010.87
5.2.50.0000.04311.17
5.2.40.0030.03010.88
5.2.30.0030.05710.93
5.2.20.0100.06010.86
5.2.10.0000.06010.87
5.2.00.0130.05010.71
5.1.60.0000.0339.92
5.1.50.0030.03310.14
5.1.40.0030.0409.88
5.1.30.0070.02310.31
5.1.20.0000.05710.34
5.1.10.0030.0509.91
5.1.00.0000.03010.08
5.0.50.0030.0278.54
5.0.40.0070.0438.38
5.0.30.0070.0608.38
5.0.20.0100.0308.34
5.0.10.0000.0338.14
5.0.00.0000.0438.11
4.4.90.0000.0377.82
4.4.80.0000.0377.82
4.4.70.0030.0337.82
4.4.60.0000.0307.82
4.4.50.0000.0207.82
4.4.40.0070.0507.82
4.4.30.0000.0237.82
4.4.20.0000.0177.82
4.4.10.0070.0137.82
4.4.00.0030.0277.82
4.3.110.0030.0207.82
4.3.100.0000.0377.82
4.3.90.0000.0377.82
4.3.80.0030.0237.82
4.3.70.0070.0237.82
4.3.60.0070.0137.82
4.3.50.0030.0137.82
4.3.40.0000.0437.82
4.3.30.0030.0307.82
4.3.20.0000.0337.82
4.3.10.0000.0177.82
4.3.00.0000.0377.82

preferences:
51.41 ms | 401 KiB | 5 Q