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.0100.00316.75
8.3.50.0120.00522.12
8.3.40.0150.00018.84
8.3.30.0100.00319.13
8.3.20.0030.00520.38
8.3.10.0040.00423.66
8.3.00.0050.00319.51
8.2.180.0090.00918.43
8.2.170.0110.00722.96
8.2.160.0070.00720.54
8.2.150.0000.00824.18
8.2.140.0070.00024.66
8.2.130.0030.01626.16
8.2.120.0030.00522.20
8.2.110.0040.00420.17
8.2.100.0040.00717.97
8.2.90.0040.00419.16
8.2.80.0040.00717.97
8.2.70.0050.00317.75
8.2.60.0040.00418.05
8.2.50.0030.00518.28
8.2.40.0030.00620.29
8.2.30.0040.00419.21
8.2.20.0000.00717.73
8.2.10.0000.00718.01
8.2.00.0080.00317.73
8.1.280.0070.00725.92
8.1.270.0040.00422.21
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0090.00022.13
8.1.230.0150.00017.64
8.1.220.0040.00417.79
8.1.210.0000.00818.77
8.1.200.0000.01117.36
8.1.190.0040.00417.36
8.1.180.0030.00518.10
8.1.170.0040.00418.71
8.1.160.0030.00718.86
8.1.150.0000.00720.16
8.1.140.0060.00317.46
8.1.130.0020.00517.88
8.1.120.0040.00417.38
8.1.110.0000.00717.50
8.1.100.0040.00417.53
8.1.90.0030.00517.43
8.1.80.0000.00717.38
8.1.70.0030.00317.36
8.1.60.0040.00417.67
8.1.50.0040.00417.50
8.1.40.0040.00417.55
8.1.30.0000.01017.62
8.1.20.0040.00417.51
8.1.10.0040.00417.54
8.1.00.0040.00417.57
8.0.300.0040.00418.77
8.0.290.0050.00316.63
8.0.280.0040.00418.47
8.0.270.0000.00717.29
8.0.260.0060.00017.27
8.0.250.0000.00716.92
8.0.240.0000.00817.03
8.0.230.0030.00316.94
8.0.220.0000.00817.00
8.0.210.0030.00316.95
8.0.200.0070.00016.98
8.0.190.0040.00416.88
8.0.180.0040.00417.00
8.0.170.0080.00016.98
8.0.160.0000.00717.04
8.0.150.0000.00816.90
8.0.140.0040.00416.88
8.0.130.0000.00613.32
8.0.120.0000.00816.91
8.0.110.0030.00517.02
8.0.100.0000.00816.92
8.0.90.0030.00516.88
8.0.80.0060.00916.85
8.0.70.0030.00517.00
8.0.60.0000.00716.95
8.0.50.0040.00416.94
8.0.30.0110.00717.11
8.0.20.0110.00817.40
8.0.10.0000.00717.12
8.0.00.0110.00616.77
7.4.330.0000.00615.08
7.4.320.0000.00616.38
7.4.300.0030.00516.65
7.4.290.0000.00716.62
7.4.280.0040.00416.61
7.4.270.0040.00416.56
7.4.260.0040.00416.63
7.4.250.0040.00416.58
7.4.240.0040.00316.53
7.4.230.0000.00716.48
7.4.220.0090.01016.48
7.4.210.0080.00916.58
7.4.200.0000.00716.68
7.4.190.0040.00416.54
7.4.160.0160.00016.53
7.4.150.0110.00717.40
7.4.140.0150.00817.86
7.4.130.0050.01116.51
7.4.120.0120.00716.51
7.4.110.0160.00916.43
7.4.100.0090.01316.66
7.4.90.0140.00316.36
7.4.80.0080.01619.39
7.4.70.0110.00516.61
7.4.60.0070.01116.67
7.4.50.0000.00716.51
7.4.40.0150.00322.77
7.4.30.0090.00916.68
7.4.10.0030.01715.14
7.4.00.0040.01215.05
7.3.330.0050.00013.38
7.3.320.0030.00313.39
7.3.310.0050.00316.40
7.3.300.0060.00016.37
7.3.290.0080.00816.36
7.3.280.0060.00916.40
7.3.270.0110.00617.40
7.3.260.0080.00816.42
7.3.250.0120.00916.49
7.3.240.0110.00716.39
7.3.230.0110.00516.58
7.3.210.0070.01116.31
7.3.200.0070.01319.39
7.3.190.0080.00816.40
7.3.180.0110.00416.60
7.3.170.0060.01516.43
7.3.160.0090.00616.52
7.3.130.0120.00914.91
7.3.120.0060.01114.91
7.3.110.0050.01014.79
7.3.100.0070.00814.89
7.3.90.0050.01114.88
7.3.80.0060.00714.76
7.3.70.0030.01114.86
7.3.60.0050.00814.72
7.3.50.0040.00914.66
7.3.40.0060.00714.70
7.3.30.0010.00814.94
7.3.20.0090.00616.73
7.3.10.0040.01016.65
7.3.00.0100.00816.49
7.2.330.0150.00316.77
7.2.320.0030.02116.74
7.2.310.0080.00816.77
7.2.300.0140.00416.64
7.2.290.0160.00016.51
7.2.260.0030.00914.88
7.2.250.0060.00915.19
7.2.240.0090.00615.17
7.2.230.0070.00714.86
7.2.220.0070.00414.94
7.2.210.0050.01214.86
7.2.200.0040.00715.02
7.2.190.0070.00915.03
7.2.180.0100.00215.10
7.2.170.0100.00515.01
7.2.160.0060.01015.05
7.2.150.0050.00916.99
7.2.140.0050.00816.95
7.2.130.0090.00816.87
7.2.120.0050.00916.65
7.2.110.0090.00916.80
7.2.100.0090.00716.84
7.2.90.0070.01016.91
7.2.80.0100.00816.88
7.2.70.0070.00816.80
7.2.60.0060.01116.74
7.2.50.0060.01116.97
7.2.40.0080.00616.89
7.2.30.0080.00916.94
7.2.20.0130.00516.75
7.2.10.0180.00816.91
7.2.00.0070.01217.36
7.1.330.0030.01016.02
7.1.320.0010.01315.84
7.1.310.0090.00915.81
7.1.300.0020.01115.67
7.1.290.0090.00615.91
7.1.280.0080.00415.79
7.1.270.0030.01015.83
7.1.260.0040.01015.67
7.1.250.0140.00415.68
7.1.240.0030.00615.67
7.1.230.0070.00715.58
7.1.220.0060.00315.53
7.1.210.0070.00715.97
7.1.200.0090.00715.71
7.1.190.0000.01015.79
7.1.180.0070.00715.62
7.1.170.0090.00615.67
7.1.160.0100.00415.93
7.1.150.0120.00315.92
7.1.140.0030.00615.90
7.1.130.0060.00615.73
7.1.120.0070.00715.89
7.1.110.0060.00615.70
7.1.100.0040.00716.95
7.1.90.0070.01115.82
7.1.80.0040.01215.97
7.1.70.0050.01016.51
7.1.60.0020.01417.64
7.1.50.0030.01716.34
7.1.40.0000.01415.86
7.1.30.0090.00615.84
7.1.20.0080.00615.73
7.1.10.0060.00615.79
7.1.00.0050.04219.19
7.0.330.0060.00615.41
7.0.320.0060.00615.41
7.0.310.0030.00515.24
7.0.300.0070.00415.41
7.0.290.0060.00615.30
7.0.280.0000.00915.30
7.0.270.0060.00915.15
7.0.260.0100.00315.59
7.0.250.0040.01115.49
7.0.240.0030.01215.29
7.0.230.0100.00715.62
7.0.220.0060.00915.23
7.0.210.0030.01015.27
7.0.200.0040.00415.86
7.0.190.0060.00615.58
7.0.180.0120.00315.38
7.0.170.0000.01315.36
7.0.160.0070.00315.49
7.0.150.0040.00815.54
7.0.140.0040.03918.79
7.0.130.0100.00015.32
7.0.120.0030.00715.34
7.0.110.0070.00715.41
7.0.100.0080.03317.60
7.0.90.0180.03417.63
7.0.80.0050.04317.72
7.0.70.0060.04617.82
7.0.60.0030.04517.70
7.0.50.0130.02817.84
7.0.40.0080.04116.81
7.0.30.0080.04716.74
7.0.20.0060.04216.83
7.0.10.0050.04516.82
7.0.00.0100.04616.58
5.6.400.0000.01014.20
5.6.390.0030.00914.56
5.6.380.0100.00314.48
5.6.370.0030.00714.18
5.6.360.0060.00614.43
5.6.350.0070.00714.41
5.6.340.0070.00714.17
5.6.330.0040.00814.36
5.6.320.0080.00014.65
5.6.310.0080.00614.57
5.6.300.0090.00013.93
5.6.290.0060.00314.14
5.6.280.0060.04017.73
5.6.270.0060.00314.18
5.6.260.0030.01014.66
5.6.250.0070.02417.58
5.6.240.0110.03617.60
5.6.230.0070.04217.41
5.6.220.0020.03817.54
5.6.210.0080.04217.50
5.6.200.0100.03017.73
5.6.190.0080.04617.73
5.6.180.0090.03217.70
5.6.170.0120.03517.76
5.6.160.0070.05017.80
5.6.150.0060.03017.71
5.6.140.0100.04317.61
5.6.130.0090.04317.64
5.6.120.0050.03917.72
5.6.110.0080.04317.65
5.6.100.0080.04617.64
5.6.90.0050.04317.85
5.6.80.0070.03317.33
5.6.70.0080.04517.34
5.6.60.0160.03417.47
5.6.50.0020.02817.28
5.6.40.0070.02217.27
5.6.30.0030.02717.27
5.6.20.0060.02517.28
5.6.10.0060.02517.37
5.6.00.0020.02917.35
5.5.380.0080.04317.46
5.5.370.0020.03617.44
5.5.360.0070.04517.42
5.5.350.0040.04217.23
5.5.340.0030.03717.58
5.5.330.0130.03717.47
5.5.320.0050.04617.56
5.5.310.0070.04517.47
5.5.300.0030.04717.40
5.5.290.0050.03217.64
5.5.280.0120.04317.70
5.5.270.0050.04217.49
5.5.260.0070.02717.60
5.5.250.0070.04517.60
5.5.240.0100.03817.18
5.5.230.0130.01717.21
5.5.220.0050.03417.22
5.5.210.0090.03717.31
5.5.200.0030.02717.13
5.5.190.0080.02017.15
5.5.180.0070.02017.29
5.5.170.0070.00714.26
5.5.160.0060.02117.23
5.5.150.0060.02117.38
5.5.140.0070.03717.11
5.5.130.0070.03917.34
5.5.120.0100.02817.27
5.5.110.0050.01817.32
5.5.100.0060.04617.14
5.5.90.0070.02717.25
5.5.80.0080.02317.22
5.5.70.0020.03217.08
5.5.60.0080.02717.10
5.5.50.0070.02217.21
5.5.40.0080.01817.23
5.5.30.0020.02817.09
5.5.20.0050.02817.12
5.5.10.0050.03217.24
5.5.00.0020.02517.03
5.4.450.0060.04416.28
5.4.440.0050.04116.21
5.4.430.0080.04016.21
5.4.420.0120.02516.22
5.4.410.0050.02416.19
5.4.400.0060.03916.07
5.4.390.0070.04016.04
5.4.380.0070.03516.11
5.4.370.0040.03316.13
5.4.360.0070.02016.10
5.4.350.0030.02016.04
5.4.340.0070.02015.97
5.4.330.0000.00813.05
5.4.320.0060.02116.09
5.4.310.0040.02116.05
5.4.300.0050.01916.13
5.4.290.0050.02816.05
5.4.280.0020.02216.00
5.4.270.0020.02516.12
5.4.260.0070.04016.04
5.4.250.0120.02516.11
5.4.240.0070.03015.98
5.4.230.0080.01815.95
5.4.220.0060.02116.09
5.4.210.0030.02215.98
5.4.200.0050.02016.08
5.4.190.0050.01816.11
5.4.180.0020.03015.99
5.4.170.0040.02316.11
5.4.160.0030.02516.01
5.4.150.0100.01715.96
5.4.140.0030.02114.64
5.4.130.0070.01814.71
5.4.120.0030.02114.73
5.4.110.0080.02014.76
5.4.100.0050.02014.74
5.4.90.0050.02014.77
5.4.80.0030.02314.76
5.4.70.0070.01814.74
5.4.60.0020.02014.71
5.4.50.0040.02114.77
5.4.40.0120.01714.71
5.4.30.0050.02014.75
5.4.20.0030.02214.63
5.4.10.0060.01814.77
5.4.00.0020.02214.35
5.3.290.0040.02413.92
5.3.280.0050.02113.86
5.3.270.0030.03313.89
5.3.260.0070.01813.89
5.3.250.0040.02113.80
5.3.240.0050.02113.88
5.3.230.0020.02413.82
5.3.220.0030.02813.88
5.3.210.0020.02213.80
5.3.200.0050.01813.79
5.3.190.0040.02213.78
5.3.180.0050.02013.82
5.3.170.0020.02013.87
5.3.160.0020.02013.77
5.3.150.0060.01913.82
5.3.140.0050.02113.82
5.3.130.0060.02613.83
5.3.120.0070.01813.77
5.3.110.0000.02313.83
5.3.100.0030.02213.57
5.3.90.0050.02513.51
5.3.80.0050.02213.59
5.3.70.0030.02113.50
5.3.60.0000.02413.59
5.3.50.0070.02013.45
5.3.40.0000.02413.57
5.3.30.0010.01813.53
5.3.20.0050.03013.34
5.3.10.0000.03213.36
5.3.00.0030.03813.29
5.2.170.0000.03011.21
5.2.160.0000.03011.21
5.2.150.0030.03011.21
5.2.140.0000.04311.09
5.2.130.0000.05311.10
5.2.120.0070.06011.10
5.2.110.0000.06711.17
5.2.100.0030.03711.17
5.2.90.0100.05011.08
5.2.80.0070.05710.96
5.2.70.0070.06010.94
5.2.60.0030.06711.11
5.2.50.0030.06311.07
5.2.40.0130.02310.84
5.2.30.0000.04311.04
5.2.20.0030.05310.83
5.2.10.0070.06010.91
5.2.00.0000.06310.77
5.1.60.0130.05310.02
5.1.50.0070.0509.84
5.1.40.0030.0579.97
5.1.30.0000.04710.25
5.1.20.0070.05710.30
5.1.10.0070.05010.10
5.1.00.0030.06010.14
5.0.50.0030.0479.55
5.0.40.0030.0409.55
5.0.30.0000.0609.55
5.0.20.0030.0209.55
5.0.10.0030.0239.55
5.0.00.0070.0639.55
4.4.90.0000.0239.55
4.4.80.0000.0379.55
4.4.70.0000.0339.55
4.4.60.0000.0409.55
4.4.50.0070.0339.55
4.4.40.0070.0309.55
4.4.30.0000.0409.55
4.4.20.0000.0409.55
4.4.10.0000.0339.55
4.4.00.0000.0509.55
4.3.110.0000.0379.55
4.3.100.0000.0309.55
4.3.90.0070.0139.55
4.3.80.0100.0339.55
4.3.70.0000.0379.55
4.3.60.0000.0309.55
4.3.50.0030.0339.55
4.3.40.0070.0279.55
4.3.30.0000.0379.55
4.3.20.0000.0279.55
4.3.10.0030.0279.55
4.3.00.0000.0209.55

preferences:
45.43 ms | 401 KiB | 5 Q