3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Carro { protected $productos = array (); public function add ( $producto, $cantidad ) { $this->productos[$producto] = $cantidad; } public function what_inside_cart () { $cadena = ""; $callback = function ( $cantidad, $producto ) use ( &$cadena ) { $cadena .= $producto . " -> " . $cantidad . "\r\n"; }; array_walk ( $this->productos, $callback ); return $cadena; } } $mi_carro = new Carro; // Añadir algunos artículos al carro $mi_carro->add ( 'mantequilla', 1 ); $mi_carro->add ( 'leche', 3 ); $mi_carro->add ( 'huevos', 6 ); //echo $mi_carro->productos[0]; // al ser protected, dará error echo $mi_carro->what_inside_cart ();

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.0110.00418.76
8.3.30.0140.00020.17
8.3.20.0040.00420.34
8.3.10.0040.00422.11
8.3.00.0080.00022.47
8.2.170.0070.00722.96
8.2.160.0090.00620.35
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0060.00320.83
8.2.110.0000.00920.35
8.2.100.0060.00617.72
8.2.90.0000.00719.22
8.2.80.0040.00419.41
8.2.70.0000.00817.61
8.2.60.0090.00018.05
8.2.50.0030.00518.07
8.2.40.0040.00418.28
8.2.30.0050.00219.45
8.2.20.0040.00417.61
8.2.10.0080.00017.68
8.2.00.0040.00417.83
8.1.270.0070.00023.99
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0000.00923.83
8.1.230.0150.00019.09
8.1.220.0000.00817.77
8.1.210.0080.00018.77
8.1.200.0070.00317.48
8.1.190.0000.00817.53
8.1.180.0000.00818.10
8.1.170.0040.00418.70
8.1.160.0000.00718.86
8.1.150.0000.00818.57
8.1.140.0040.00417.45
8.1.130.0000.00717.88
8.1.120.0000.00917.53
8.1.110.0040.00417.36
8.1.100.0000.00817.39
8.1.90.0000.00817.41
8.1.80.0000.00817.47
8.1.70.0030.00317.46
8.1.60.0000.00717.62
8.1.50.0040.00417.58
8.1.40.0060.00317.43
8.1.30.0080.00017.64
8.1.20.0000.00917.55
8.1.10.0000.00717.48
8.1.00.0050.00317.47
8.0.300.0000.00818.77
8.0.290.0000.00817.18
8.0.280.0000.00818.44
8.0.270.0030.00317.27
8.0.260.0000.00716.74
8.0.250.0000.00716.98
8.0.240.0000.00816.96
8.0.230.0000.00717.01
8.0.220.0070.00016.96
8.0.210.0040.00416.88
8.0.200.0040.00416.96
8.0.190.0000.00916.99
8.0.180.0040.00416.93
8.0.170.0040.00416.90
8.0.160.0070.00016.78
8.0.150.0040.00416.73
8.0.140.0030.00316.82
8.0.130.0050.00013.33
8.0.120.0050.00216.73
8.0.110.0040.00416.89
8.0.100.0000.00716.87
8.0.90.0000.00716.74
8.0.80.0070.01716.78
8.0.70.0000.00716.76
8.0.60.0070.00016.85
8.0.50.0040.00416.90
8.0.30.0130.00616.87
8.0.20.0150.01017.40
8.0.10.0000.00716.96
8.0.00.0070.01516.72
7.4.330.0030.00316.91
7.4.320.0030.00316.51
7.4.300.0030.00316.65
7.4.290.0050.00316.46
7.4.280.0030.00316.57
7.4.270.0000.00716.51
7.4.260.0000.00513.16
7.4.250.0000.00816.45
7.4.240.0000.00716.63
7.4.230.0030.00316.58
7.4.220.0030.01416.69
7.4.210.0060.00916.60
7.4.200.0050.00216.34
7.4.190.0030.00316.48
7.4.160.0170.00716.50
7.4.150.0040.01217.40
7.4.140.0120.00517.86
7.4.130.0100.01016.57
7.4.120.0050.01316.57
7.4.110.0070.01016.59
7.4.100.0060.01216.51
7.4.90.0110.00616.60
7.4.80.0090.00919.39
7.4.70.0030.01416.53
7.4.60.0060.01316.54
7.4.50.0090.00016.51
7.4.40.0090.00622.77
7.4.30.0070.01016.52
7.4.00.0040.00814.91
7.3.330.0060.00013.20
7.3.320.0000.00613.32
7.3.310.0000.00716.36
7.3.300.0030.00316.23
7.3.290.0070.00716.38
7.3.280.0070.01316.38
7.3.270.0100.01317.40
7.3.260.0130.00716.42
7.3.250.0050.01216.53
7.3.240.0060.01216.57
7.3.230.0170.00416.56
7.3.210.0090.00716.27
7.3.200.0030.01319.39
7.3.190.0040.01516.38
7.3.180.0130.00916.60
7.3.170.0050.01516.50
7.3.160.0110.00716.28
7.3.120.0040.01214.49
7.3.00.0100.01016.57
7.2.330.0100.00716.72
7.2.320.0070.01016.53
7.2.310.0090.00916.70
7.2.300.0100.00616.71
7.2.290.0110.00516.78
7.2.130.0170.00316.98
7.2.120.0150.00416.89
7.2.110.0140.00316.96
7.2.100.0070.01116.76
7.2.90.0080.00416.96
7.2.80.0170.00016.84
7.2.70.0070.01017.11
7.2.60.0050.00716.82
7.2.50.0130.00017.04
7.2.40.0140.00316.84
7.2.30.0120.00416.99
7.2.20.0100.00716.88
7.2.10.0040.01416.66
7.2.00.0160.00016.61
7.1.250.0110.00815.78
7.1.240.0070.00715.57
7.1.230.0070.00715.80
7.1.220.0090.00615.81
7.1.210.0090.00615.54
7.1.200.0030.01015.60
7.1.190.0100.00715.85
7.1.180.0130.00015.76
7.1.170.0150.00615.67
7.1.160.0080.00415.72
7.1.150.0070.01115.95
7.1.140.0080.01115.89
7.1.130.0110.00715.80
7.1.120.0070.01015.65
7.1.110.0070.01115.69
7.1.100.0100.00715.89
7.1.90.0110.01015.57
7.1.80.0160.00315.51
7.1.70.0030.00816.39
7.1.60.0070.01317.47
7.1.50.0080.01016.32
7.1.40.0070.01015.44
7.1.30.0020.01015.64
7.1.20.0110.00315.42
7.1.10.0110.00715.65
7.1.00.0020.04519.12
7.0.330.0100.00715.20
7.0.320.0070.00715.34
7.0.310.0110.00715.45
7.0.300.0120.00015.37
7.0.290.0030.01315.25
7.0.280.0130.00715.42
7.0.270.0070.01115.27
7.0.260.0070.01015.55
7.0.250.0130.00315.51
7.0.240.0090.00615.38
7.0.230.0130.00315.26
7.0.220.0080.00515.40
7.0.210.0100.00715.04
7.0.200.0060.00715.92
7.0.190.0000.01215.33
7.0.180.0080.00815.04
7.0.170.0080.00415.15
7.0.160.0000.01315.62
7.0.150.0070.01015.38
7.0.140.0060.04018.71
7.0.130.0080.00615.34
7.0.120.0130.00315.60
7.0.110.0060.01015.59
7.0.100.0100.01015.29
7.0.90.0150.00015.38
7.0.80.0160.00315.52
7.0.70.0130.00615.43
7.0.60.0080.04018.60
7.0.50.0080.04318.76
7.0.40.0050.04516.80
7.0.30.0070.03716.79
7.0.20.0050.04716.82
7.0.10.0030.04316.74
7.0.00.0060.03216.67
5.6.380.0080.00414.49
5.6.370.0040.00714.64
5.6.360.0070.00414.41
5.6.350.0100.00314.71
5.6.340.0030.00714.54
5.6.330.0060.00614.46
5.6.320.0090.00914.50
5.6.310.0040.01014.35
5.6.300.0070.00714.05
5.6.290.0000.01314.18
5.6.280.0030.04417.51
5.6.270.0060.00914.59
5.6.260.0030.01114.25
5.6.250.0000.01214.20
5.6.240.0060.00614.54
5.6.230.0040.01214.51
5.6.220.0070.01014.36
5.6.210.0050.03517.45
5.6.200.0070.04717.69
5.6.190.0070.03617.72
5.6.180.0050.03117.57
5.6.170.0100.04017.67
5.6.160.0070.04417.67
5.6.150.0080.04317.79
5.6.140.0050.03117.81
5.6.130.0050.04517.58
5.6.120.0040.04617.69
5.6.110.0050.04517.70
5.6.100.0050.04317.74
5.6.90.0110.03817.93
5.6.80.0030.04317.32
5.6.70.0100.03717.41
5.6.60.0070.04317.44
5.6.50.0070.04017.46
5.6.40.0030.04517.44
5.6.30.0100.04017.32
5.6.20.0000.04017.19
5.6.10.0020.04717.26
5.6.00.0030.04717.18
5.5.380.0070.00410.95
5.5.370.0030.00611.21
5.5.360.0030.00611.27
5.5.350.0030.03815.94
5.5.340.0030.03016.04
5.5.330.0030.04316.05
5.5.320.0060.03316.24
5.5.310.0060.04416.13
5.5.300.0040.04516.04
5.5.290.0080.04016.27
5.5.280.0060.03616.13
5.5.270.0030.03416.18
5.5.260.0030.04015.95
5.5.250.0050.04216.01
5.5.240.0030.04015.79
5.5.230.0080.04215.71
5.5.220.0010.04315.72
5.5.210.0050.04015.72
5.5.200.0030.03315.73
5.5.190.0020.04315.81
5.5.180.0050.04215.79
5.5.170.0030.00811.16
5.5.160.0050.03915.72
5.5.150.0050.04315.65
5.5.140.0060.03615.64
5.5.130.0050.03315.70
5.5.120.0100.03715.83
5.5.110.0080.03815.61
5.5.100.0090.03715.55
5.5.90.0080.03715.62
5.5.80.0050.03915.73
5.5.70.0050.03715.68
5.5.60.0020.03415.70
5.5.50.0100.03815.70
5.5.40.0020.04015.51
5.5.30.0050.02815.67
5.5.20.0030.04015.63
5.5.10.0010.03415.50
5.5.00.0030.04215.69
5.4.450.0060.04515.10
5.4.440.0080.04015.41
5.4.430.0120.03415.23
5.4.420.0030.04515.33
5.4.410.0030.03915.21
5.4.400.0030.03515.12
5.4.390.0010.03815.03
5.4.380.0070.03014.98
5.4.370.0050.03815.07
5.4.360.0050.04315.20
5.4.350.0060.03415.03
5.4.340.0080.03314.98
5.4.330.0000.01211.02
5.4.320.0040.04015.03
5.4.310.0050.04115.15
5.4.300.0030.03915.15
5.4.290.0040.02715.08
5.4.280.0060.04115.12
5.4.270.0030.04015.01
5.4.260.0070.03815.05
5.4.250.0080.02715.03
5.4.240.0020.04115.02
5.4.230.0000.04115.13
5.4.220.0020.02315.10
5.4.210.0050.03715.12
5.4.200.0020.04215.05
5.4.190.0060.03515.14
5.4.180.0080.03715.07
5.4.170.0060.03815.06
5.4.160.0090.03714.97
5.4.150.0000.03214.95
5.4.140.0080.03213.79
5.4.130.0030.03413.57
5.4.120.0030.03813.69
5.4.110.0060.03713.82
5.4.100.0080.03313.63
5.4.90.0090.03513.94
5.4.80.0050.03513.65
5.4.70.0020.04213.80
5.4.60.0070.03713.76
5.4.50.0110.03713.80
5.4.40.0050.03913.80
5.4.30.0080.03513.79
5.4.20.0030.02913.76
5.4.10.0000.03413.71
5.4.00.0040.03513.51
5.3.290.0030.04212.83
5.3.280.0030.03712.79
5.3.270.0030.03512.71
5.3.260.0030.03612.78
5.3.250.0050.03412.78
5.3.240.0050.03512.78
5.3.230.0080.03712.78
5.3.220.0070.03312.72
5.3.210.0050.04012.69
5.3.200.0050.04012.76
5.3.190.0040.04112.76
5.3.180.0060.03812.72
5.3.170.0020.03712.76
5.3.160.0060.03612.79
5.3.150.0020.04312.72
5.3.140.0020.03912.76
5.3.130.0020.04012.75
5.3.120.0030.04212.66
5.3.110.0050.03712.65
5.3.100.0030.04012.48
5.3.90.0030.03612.42
5.3.80.0050.03812.45
5.3.70.0020.04012.45
5.3.60.0050.03512.40
5.3.50.0060.03612.44
5.3.40.0020.04012.47
5.3.30.0020.04212.44
5.3.20.0020.03712.35
5.3.10.0050.03812.28
5.3.00.0060.02512.23
5.2.170.0020.03311.04
5.2.160.0040.03410.97
5.2.150.0050.03310.95
5.2.140.0020.03311.06
5.2.130.0080.02211.01
5.2.120.0020.03311.04
5.2.110.0000.03611.02
5.2.100.0040.03211.02
5.2.90.0030.02211.03
5.2.80.0020.03210.99
5.2.70.0020.03511.05
5.2.60.0070.03111.03
5.2.50.0020.03510.99
5.2.40.0070.03110.98
5.2.30.0050.02710.94
5.2.20.0060.03310.86
5.2.10.0000.03310.92
5.2.00.0020.03810.84
5.1.60.0020.03010.65
5.1.50.0030.02610.65
5.1.40.0020.03010.65
5.1.30.0030.03110.65
5.1.20.0020.02310.65
5.1.10.0070.02510.65
5.1.00.0020.03210.65
5.0.50.0050.02510.65
5.0.40.0040.02310.65
5.0.30.0020.03110.65
5.0.20.0000.02510.65
5.0.10.0020.02510.65
5.0.00.0050.03210.65
4.4.90.0010.01910.65
4.4.80.0030.02010.65
4.4.70.0000.01710.65
4.4.60.0020.02010.65
4.4.50.0000.01610.65
4.4.40.0050.02510.65
4.4.30.0050.01710.65
4.4.20.0020.02010.65
4.4.10.0040.01410.65
4.4.00.0020.03010.65
4.3.110.0050.01510.65
4.3.100.0020.02010.65
4.3.90.0010.01910.65
4.3.80.0020.02310.65
4.3.70.0010.01810.65
4.3.60.0000.02010.65
4.3.50.0000.01910.65
4.3.40.0020.02710.65
4.3.30.0020.01710.65
4.3.20.0030.01610.65
4.3.10.0000.02010.65
4.3.00.0020.02010.65

preferences:
43.99 ms | 400 KiB | 5 Q