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 = ""; array_walk ( $this->productos, function ( $cantidad, $producto ) use ( &$cadena ) { $cadena .= $producto . " -> " . $cantidad . "\r\n"; }); 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.0040.01118.80
8.3.30.0000.01420.34
8.3.20.0000.00720.29
8.3.10.0040.00422.02
8.3.00.0080.00022.32
8.2.170.0040.01122.96
8.2.160.0150.00020.52
8.2.150.0080.00024.18
8.2.140.0090.00024.66
8.2.130.0070.00026.16
8.2.120.0080.00020.66
8.2.110.0060.00321.95
8.2.100.0060.00617.91
8.2.90.0030.00619.17
8.2.80.0030.00519.09
8.2.70.0060.00617.38
8.2.60.0030.00618.16
8.2.50.0040.00418.07
8.2.40.0080.00018.21
8.2.30.0040.00419.41
8.2.20.0030.00617.80
8.2.10.0000.00817.67
8.2.00.0040.00417.64
8.1.270.0060.00323.99
8.1.260.0050.00226.35
8.1.250.0080.00028.09
8.1.240.0090.00023.80
8.1.230.0030.00819.01
8.1.220.0060.00317.74
8.1.210.0090.00018.77
8.1.200.0030.00717.35
8.1.190.0000.00817.54
8.1.180.0030.00618.10
8.1.170.0040.00418.40
8.1.160.0000.00718.82
8.1.150.0040.00418.66
8.1.140.0040.00417.46
8.1.130.0070.00017.76
8.1.120.0000.00717.40
8.1.110.0000.00817.43
8.1.100.0040.00417.39
8.1.90.0000.00717.37
8.1.80.0080.00017.46
8.1.70.0000.00717.50
8.1.60.0050.00317.64
8.1.50.0050.00217.52
8.1.40.0000.00817.53
8.1.30.0030.00517.62
8.1.20.0030.00517.63
8.1.10.0090.00017.61
8.1.00.0000.00917.39
8.0.300.0040.00418.77
8.0.290.0040.00417.18
8.0.280.0050.00318.40
8.0.270.0000.00717.14
8.0.260.0000.00716.81
8.0.250.0000.00716.88
8.0.240.0030.00616.93
8.0.230.0070.00017.02
8.0.220.0000.00616.90
8.0.210.0030.00316.77
8.0.200.0000.00716.94
8.0.190.0000.00716.96
8.0.180.0000.00716.91
8.0.170.0050.00316.99
8.0.160.0030.00516.75
8.0.150.0050.00216.89
8.0.140.0070.00016.86
8.0.130.0030.00313.30
8.0.120.0040.00416.77
8.0.110.0040.00416.84
8.0.100.0020.00516.71
8.0.90.0050.00216.73
8.0.80.0140.00616.88
8.0.70.0040.00416.86
8.0.60.0070.00016.76
8.0.50.0020.00516.91
8.0.30.0100.01217.01
8.0.20.0080.01217.40
8.0.10.0040.00416.96
8.0.00.0080.01316.72
7.4.330.0000.00516.79
7.4.320.0030.00316.44
7.4.300.0060.00016.52
7.4.290.0030.00316.50
7.4.280.0040.00416.69
7.4.270.0030.00316.42
7.4.260.0030.00313.30
7.4.250.0040.00416.58
7.4.240.0020.00616.51
7.4.230.0030.00316.46
7.4.220.0120.00616.61
7.4.210.0060.01016.62
7.4.200.0030.00316.62
7.4.190.0030.00316.68
7.4.160.0160.00016.39
7.4.150.0070.01017.40
7.4.140.0080.00917.86
7.4.130.0130.00516.57
7.4.120.0070.01016.55
7.4.110.0040.01316.66
7.4.100.0110.00616.57
7.4.90.0150.00316.41
7.4.80.0040.01319.39
7.4.70.0160.00016.61
7.4.60.0070.01016.61
7.4.50.0000.00616.55
7.4.40.0070.01022.77
7.4.30.0100.00716.59
7.4.10.0110.00714.73
7.4.00.0050.00915.11
7.3.330.0030.00313.15
7.3.320.0050.00013.37
7.3.310.0040.00416.22
7.3.300.0030.00316.42
7.3.290.0120.00316.39
7.3.280.0130.00416.33
7.3.270.0070.01317.40
7.3.260.0090.00916.36
7.3.250.0080.01016.35
7.3.240.0120.00616.42
7.3.230.0130.00616.46
7.3.210.0140.00316.56
7.3.200.0080.00819.39
7.3.190.0070.01516.39
7.3.180.0100.00716.36
7.3.170.0090.01316.52
7.3.160.0030.00316.63
7.3.130.0130.00614.88
7.3.120.0100.00714.89
7.3.110.0060.00914.63
7.3.100.0040.00815.03
7.3.90.0050.01114.80
7.3.80.0060.00814.77
7.3.70.0060.00814.81
7.3.60.0040.00914.63
7.3.50.0050.00614.71
7.3.40.0020.01014.77
7.3.30.0050.00814.91
7.3.20.0020.01316.59
7.3.10.0080.00516.56
7.3.00.0030.00916.67
7.2.330.0090.00916.72
7.2.320.0100.01316.49
7.2.310.0150.00816.63
7.2.300.0080.00816.72
7.2.290.0070.01016.83
7.2.260.0060.00514.89
7.2.250.0110.00615.27
7.2.240.0050.01215.09
7.2.230.0080.00815.07
7.2.220.0050.00815.02
7.2.210.0080.00615.21
7.2.200.0090.00615.02
7.2.190.0050.00815.04
7.2.180.0060.00515.06
7.2.170.0050.00414.99
7.2.160.0050.01215.04
7.2.150.0010.01016.86
7.2.140.0090.00516.83
7.2.130.0050.00916.97
7.2.120.0050.00816.91
7.2.110.0050.01116.85
7.2.100.0100.00616.81
7.2.90.0020.01317.04
7.2.80.0050.00916.96
7.2.70.0060.00816.81
7.2.60.0050.01117.05
7.2.50.0060.00616.80
7.2.40.0080.00616.96
7.2.30.0060.00817.08
7.2.20.0070.00616.97
7.2.10.0060.00816.79
7.2.00.0060.00717.54
7.1.330.0050.00915.71
7.1.320.0040.01015.92
7.1.310.0070.00715.87
7.1.300.0050.00615.77
7.1.290.0060.00815.88
7.1.280.0000.00915.75
7.1.270.0000.01215.70
7.1.260.0070.00715.73
7.1.250.0060.00815.83
7.1.240.0030.00615.93
7.1.230.0100.00715.92
7.1.220.0090.00615.84
7.1.210.0030.00715.62
7.1.200.0080.00615.82
7.1.190.0070.00716.00
7.1.180.0030.01015.50
7.1.170.0030.00715.77
7.1.160.0070.00715.99
7.1.150.0070.01015.89
7.1.140.0070.00715.75
7.1.130.0070.00715.90
7.1.120.0070.00415.46
7.1.110.0060.00715.71
7.1.100.0090.00516.99
7.1.90.0070.00715.88
7.1.80.0110.00415.91
7.1.70.0050.00716.47
7.1.60.0100.00717.50
7.1.50.0080.00716.30
7.1.40.0090.00615.63
7.1.30.0000.00815.78
7.1.20.0090.00015.87
7.1.10.0100.00315.59
7.1.00.0060.04119.16
7.0.330.0030.01115.52
7.0.320.0060.00315.28
7.0.310.0100.00715.45
7.0.300.0000.01115.41
7.0.290.0140.00415.47
7.0.280.0040.00415.43
7.0.270.0130.00315.52
7.0.260.0070.01015.39
7.0.250.0040.00815.57
7.0.240.0000.01115.26
7.0.230.0030.01015.21
7.0.220.0080.00815.13
7.0.210.0030.00915.55
7.0.200.0070.00315.90
7.0.190.0030.00915.26
7.0.180.0060.00615.57
7.0.170.0000.01215.23
7.0.160.0030.00715.35
7.0.150.0040.01115.43
7.0.140.0040.04218.71
7.0.130.0050.00515.40
7.0.120.0090.00315.64
7.0.110.0070.00715.53
7.0.100.0110.04217.71
7.0.90.0030.04717.57
7.0.80.0100.04217.75
7.0.70.0060.02417.87
7.0.60.0130.04017.53
7.0.50.0050.04017.83
7.0.40.0050.02716.85
7.0.30.0090.04116.79
7.0.20.0030.04916.71
7.0.10.0080.03016.78
7.0.00.0120.03316.87
5.6.400.0000.01514.54
5.6.390.0040.01114.78
5.6.380.0070.00314.46
5.6.370.0070.01014.46
5.6.360.0070.00714.54
5.6.350.0000.01014.52
5.6.340.0040.01114.44
5.6.330.0090.00614.24
5.6.320.0090.00914.38
5.6.310.0080.00514.49
5.6.300.0000.01614.59
5.6.290.0100.00714.66
5.6.280.0030.04117.88
5.6.270.0030.01014.63
5.6.260.0030.01014.55
5.6.250.0100.04617.66
5.6.240.0100.04217.60
5.6.230.0030.03917.79
5.6.220.0050.04917.66
5.6.210.0070.04717.63
5.6.200.0100.04017.74
5.6.190.0040.02717.70
5.6.180.0050.03517.93
5.6.170.0100.03517.83
5.6.160.0000.03317.60
5.6.150.0030.03817.63
5.6.140.0100.03117.72
5.6.130.0060.04317.65
5.6.120.0050.02517.69
5.6.110.0020.02817.84
5.6.100.0070.02217.66
5.6.90.0040.02017.87
5.6.80.0030.02117.43
5.6.70.0020.02217.23
5.6.60.0030.02117.48
5.6.50.0050.02517.35
5.6.40.0070.04417.32
5.6.30.0050.03517.40
5.6.20.0020.02517.49
5.6.10.0100.03017.49
5.6.00.0050.02717.48
5.5.380.0120.03517.40
5.5.370.0030.02717.24
5.5.360.0070.04517.38
5.5.350.0070.04017.41
5.5.340.0020.03017.65
5.5.330.0050.04517.54
5.5.320.0070.04617.62
5.5.310.0130.04217.72
5.5.300.0120.04017.58
5.5.290.0050.04517.53
5.5.280.0070.02317.61
5.5.270.0140.01517.68
5.5.260.0020.02717.59
5.5.250.0070.02417.55
5.5.240.0070.02317.34
5.5.230.0050.02017.27
5.5.220.0020.02217.17
5.5.210.0060.03817.23
5.5.200.0030.01917.37
5.5.190.0030.02317.30
5.5.180.0070.02617.32
5.5.170.0060.00314.42
5.5.160.0020.02617.15
5.5.150.0080.02217.37
5.5.140.0060.01817.37
5.5.130.0080.02017.20
5.5.120.0100.01517.20
5.5.110.0070.02017.16
5.5.100.0040.02317.28
5.5.90.0070.02217.32
5.5.80.0020.02717.37
5.5.70.0030.02617.11
5.5.60.0060.01717.16
5.5.50.0060.02317.31
5.5.40.0070.01817.17
5.5.30.0030.02717.23
5.5.20.0050.02317.05
5.5.10.0090.01717.14
5.5.00.0050.02516.98
5.4.450.0050.03715.47
5.4.440.0030.02415.47
5.4.430.0020.02415.46
5.4.420.0050.02015.45
5.4.410.0070.02215.38
5.4.400.0030.02015.24
5.4.390.0030.01815.24
5.4.380.0100.01615.28
5.4.370.0060.02015.28
5.4.360.0020.02615.26
5.4.350.0070.04015.31
5.4.340.0050.04215.27
5.4.330.0070.00311.38
5.4.320.0020.02715.26
5.4.310.0080.02815.25
5.4.300.0050.02215.21
5.4.290.0090.01515.21
5.4.280.0000.02415.14
5.4.270.0040.02015.12
5.4.260.0070.01715.15
5.4.250.0050.02215.13
5.4.240.0050.02215.11
5.4.230.0050.02015.23
5.4.220.0030.02615.22
5.4.210.0040.02115.16
5.4.200.0020.02515.20
5.4.190.0090.01615.16
5.4.180.0030.02315.14
5.4.170.0060.02515.11
5.4.160.0010.01915.24
5.4.150.0050.02315.15
5.4.140.0030.02213.82
5.4.130.0040.02214.01
5.4.120.0070.01713.88
5.4.110.0070.02713.91
5.4.100.0040.01913.97
5.4.90.0000.03113.91
5.4.80.0060.01813.96
5.4.70.0000.04013.95
5.4.60.0020.04213.85
5.4.50.0070.03813.95
5.4.40.0120.03513.90
5.4.30.0060.03613.86
5.4.20.0030.03113.89
5.4.10.0050.04013.93
5.4.00.0090.02113.66
5.3.290.0020.02313.05
5.3.280.0020.02213.00
5.3.270.0070.01912.99
5.3.260.0030.01712.96
5.3.250.0040.02513.01
5.3.240.0020.02013.03
5.3.230.0020.02213.03
5.3.220.0050.02113.01
5.3.210.0030.03212.99
5.3.200.0020.02213.03
5.3.190.0050.02513.01
5.3.180.0010.02112.99
5.3.170.0030.04312.97
5.3.160.0030.04112.99
5.3.150.0050.03512.97
5.3.140.0030.02213.02
5.3.130.0020.03413.03
5.3.120.0060.02012.97
5.3.110.0060.04113.00
5.3.100.0040.04212.77
5.3.90.0050.03812.74
5.3.80.0060.03012.72
5.3.70.0060.02112.76
5.3.60.0060.03612.72
5.3.50.0050.04012.64
5.3.40.0000.03112.72
5.3.30.0030.03812.71
5.3.20.0020.03812.55
5.3.10.0050.02512.59
5.3.00.0030.04512.55
5.2.170.0070.06312.39
5.2.160.0030.06012.39
5.2.150.0030.03012.39
5.2.140.0070.04712.39
5.2.130.0000.06312.39
5.2.120.0170.05012.39
5.2.110.0030.04312.39
5.2.100.0070.04312.39
5.2.90.0030.05712.39
5.2.80.0030.04712.39
5.2.70.0030.05712.39
5.2.60.0000.06312.39
5.2.50.0070.06312.39
5.2.40.0100.06012.39
5.2.30.0030.03712.39
5.2.20.0100.05712.39
5.2.10.0170.03312.39
5.2.00.0130.04312.39
5.1.60.0000.04712.39
5.1.50.0030.05712.39
5.1.40.0100.04712.39
5.1.30.0030.03712.39
5.1.20.0100.03712.39
5.1.10.0000.06012.39
5.1.00.0070.05312.39
5.0.50.0000.04312.39
5.0.40.0070.04012.39
5.0.30.0070.06312.39
5.0.20.0000.02712.39
5.0.10.0030.03712.39
5.0.00.0070.06012.39
4.4.90.0030.03312.39
4.4.80.0000.03712.39
4.4.70.0030.03312.39
4.4.60.0030.02012.39
4.4.50.0030.03312.39
4.4.40.0030.05712.39
4.4.30.0070.03012.39
4.4.20.0000.02312.39
4.4.10.0100.03012.39
4.4.00.0030.05312.39
4.3.110.0000.03712.39
4.3.100.0000.03712.39
4.3.90.0000.03012.39
4.3.80.0030.04312.39
4.3.70.0030.03312.39
4.3.60.0000.03712.39
4.3.50.0000.03312.39
4.3.40.0030.03012.39
4.3.30.0030.03712.39
4.3.20.0030.02312.39
4.3.10.0030.01312.39
4.3.00.0030.03312.39

preferences:
43.65 ms | 400 KiB | 5 Q