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.70.0000.01516.63
8.3.60.0180.00016.88
8.3.50.0070.01022.05
8.3.40.0070.01118.79
8.3.30.0030.01019.12
8.3.20.0050.00320.21
8.3.10.0080.00023.61
8.3.00.0040.00419.69
8.2.180.0070.01118.41
8.2.170.0100.00722.96
8.2.160.0100.00320.43
8.2.150.0000.00724.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0030.00619.48
8.2.110.0060.00322.06
8.2.100.0060.00620.35
8.2.90.0060.00319.34
8.2.80.0060.00317.97
8.2.70.0030.00717.75
8.2.60.0000.00917.93
8.2.50.0030.00518.07
8.2.40.0080.00018.28
8.2.30.0030.00518.33
8.2.20.0000.00817.81
8.2.10.0040.00418.06
8.2.00.0080.00019.52
8.1.280.0140.00025.92
8.1.270.0000.00823.96
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.93
8.1.230.0120.00019.22
8.1.220.0040.00417.79
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0030.00517.35
8.1.180.0050.00318.10
8.1.170.0080.00018.38
8.1.160.0000.00722.03
8.1.150.0040.00418.64
8.1.140.0000.00717.46
8.1.130.0000.00717.80
8.1.120.0050.00217.37
8.1.110.0040.00417.46
8.1.100.0040.00417.36
8.1.90.0000.00717.44
8.1.80.0000.00717.51
8.1.70.0000.00717.39
8.1.60.0040.00417.54
8.1.50.0060.00317.55
8.1.40.0040.00417.42
8.1.30.0030.00617.67
8.1.20.0000.00817.49
8.1.10.0030.00517.46
8.1.00.0040.00417.43
8.0.300.0040.00418.77
8.0.290.0000.00816.63
8.0.280.0000.00718.45
8.0.270.0070.00017.27
8.0.260.0030.00317.18
8.0.250.0030.00316.86
8.0.240.0050.00316.94
8.0.230.0050.00316.94
8.0.220.0000.00716.92
8.0.210.0030.00516.92
8.0.200.0000.00616.95
8.0.190.0000.00716.98
8.0.180.0080.00416.81
8.0.170.0060.00316.85
8.0.160.0020.00516.92
8.0.150.0030.00616.86
8.0.140.0040.00316.93
8.0.130.0070.00013.37
8.0.120.0000.00816.85
8.0.110.0000.00916.78
8.0.100.0060.00316.74
8.0.90.0000.00716.88
8.0.80.0040.01116.84
8.0.70.0000.00816.79
8.0.60.0000.00816.91
8.0.50.0000.00716.68
8.0.30.0120.00716.98
8.0.20.0080.01517.40
8.0.10.0070.00016.91
8.0.00.0050.01516.86
7.4.330.0000.00515.08
7.4.320.0030.00316.50
7.4.300.0030.00316.61
7.4.290.0030.00316.49
7.4.280.0000.00716.62
7.4.270.0000.00716.61
7.4.260.0000.00816.38
7.4.250.0080.00016.48
7.4.240.0050.00316.51
7.4.230.0000.00716.39
7.4.220.0140.00416.59
7.4.210.0000.01416.38
7.4.200.0030.00316.26
7.4.160.0070.01016.42
7.4.150.0220.02217.40
7.4.140.0090.01217.86
7.4.130.0100.01016.44
7.4.120.0070.01016.59
7.4.110.0100.00616.57
7.4.100.0080.00816.49
7.4.90.0110.00616.52
7.4.80.0060.01619.39
7.4.70.0060.01216.61
7.4.60.0090.00616.46
7.4.50.0040.00416.68
7.4.40.0090.00616.72
7.4.30.0100.00716.42
7.4.00.0110.00715.03
7.3.330.0000.00513.33
7.3.320.0000.00513.31
7.3.310.0030.00316.23
7.3.300.0070.00016.30
7.3.290.0100.00716.37
7.3.280.0050.01216.34
7.3.270.0070.01117.40
7.3.260.0120.00616.59
7.3.250.0120.00516.52
7.3.240.0110.00716.70
7.3.230.0130.00316.42
7.3.210.0050.01116.66
7.3.200.0090.01219.39
7.3.190.0150.00316.57
7.3.180.0060.01316.50
7.3.170.0040.01416.52
7.3.160.0070.01416.27
7.3.120.0070.01014.59
7.3.10.0030.00716.80
7.3.00.0070.00516.63
7.2.330.0170.00616.66
7.2.320.0070.01016.71
7.2.310.0070.01016.82
7.2.300.0410.01616.36
7.2.290.0100.00716.46
7.2.130.0070.00716.89
7.2.120.0030.00716.95
7.2.110.0050.00616.96
7.2.100.0030.00716.99
7.2.90.0060.00516.88
7.2.80.0030.00816.84
7.2.70.0040.00716.88
7.2.60.0080.00616.79
7.2.50.0050.00616.97
7.2.40.0060.00717.06
7.2.30.0080.00316.91
7.2.20.0050.00516.76
7.2.10.0060.00816.84
7.2.00.0090.00517.76
7.1.250.0040.00615.68
7.1.200.0040.00416.00
7.1.100.0060.00618.04
7.1.70.0120.00317.16
7.1.60.0110.01419.70
7.1.50.0130.01016.87
7.1.00.0030.07722.31
7.0.200.0090.00416.94
7.0.140.0170.06022.13
7.0.60.0030.06319.82
7.0.50.0070.08017.87
7.0.40.0070.05320.10
7.0.30.0270.05720.06
7.0.20.0100.05020.10
7.0.10.0170.04020.13
7.0.00.0130.07320.22
5.6.280.0030.07020.94
5.6.210.0100.06720.74
5.6.200.0030.08318.22
5.6.190.0070.05020.57
5.6.180.0430.06020.77
5.6.170.0170.04020.57
5.6.160.0070.06320.43
5.6.150.0070.04018.16
5.6.140.0070.04718.23
5.6.130.0070.05018.23
5.6.120.0030.08020.98
5.6.110.0170.07721.02
5.6.100.0070.08721.02
5.6.90.0070.08720.98
5.6.80.0100.07320.38
5.6.70.0200.03320.53
5.5.350.0030.08020.44
5.5.340.0030.06317.99
5.5.330.0000.05720.27
5.5.320.0230.04320.31
5.5.310.0230.03720.34
5.5.300.0070.08017.94
5.5.290.0100.07718.04
5.5.280.0170.07720.86
5.5.270.0100.06720.82
5.5.260.0070.08020.99
5.5.250.0070.05320.48
5.5.240.0000.04020.28
5.4.450.0600.07019.49
5.4.440.0500.06719.47
5.4.430.0570.06719.47
5.4.420.0530.07019.27
5.4.410.0470.05719.41
5.4.400.0500.06019.23
5.4.390.0600.06319.00
5.4.380.0470.07018.95
5.4.370.0530.05719.22
5.4.360.0470.06318.95
5.4.350.0400.05019.08
5.4.340.0430.06019.13
5.4.320.0430.06319.30
5.4.310.0470.06319.24
5.4.300.0430.04319.06
5.4.290.0430.05719.08
5.4.280.0330.04019.30
5.4.270.0400.03018.87
5.4.260.0330.04319.18
5.4.250.0430.04019.14
5.4.240.0400.03018.94
5.4.230.0400.07318.99
5.4.220.0430.05019.14
5.4.210.0470.06019.04
5.4.200.0370.03719.07
5.4.190.0330.03718.99
5.4.180.0500.05319.18
5.4.170.0430.05719.11
5.4.160.0430.03319.20
5.4.150.0300.05718.93
5.4.140.0400.03716.39
5.4.130.0330.04016.55
5.4.120.0300.03716.38
5.4.110.0370.03316.63
5.4.100.0470.05016.59
5.4.90.0370.04016.47
5.4.80.0370.04016.63
5.4.70.0430.06316.41
5.4.60.0500.05316.54
5.4.50.0370.04316.55
5.4.40.0470.05016.34
5.4.30.0400.03716.52
5.4.20.0530.06716.50
5.4.10.0500.06316.53
5.4.00.0500.06715.95
5.3.290.0500.05014.75
5.3.280.0430.03714.58
5.3.270.0530.03714.59
5.3.260.0470.03314.54
5.3.250.0470.05714.53
5.3.240.0400.06314.62
5.3.230.0500.06314.72
5.3.220.0500.04014.80
5.3.210.0470.07314.49
5.3.200.0500.06714.55
5.3.190.0570.06014.49
5.3.180.0470.04714.65
5.3.170.0570.06014.54
5.3.160.0600.04014.72
5.3.150.0530.06014.58
5.3.140.0530.06314.64
5.3.130.0500.06314.70
5.3.120.0570.05014.67
5.3.110.0600.06014.47
5.3.100.0500.05013.96
5.3.90.0430.03713.94
5.3.80.0370.04014.04
5.3.70.0330.04314.11
5.3.60.0500.06314.09
5.3.50.0500.06713.88
5.3.40.0470.04714.21
5.3.30.0500.06314.04
5.3.20.0470.07313.71
5.3.10.0370.04013.57
5.3.00.0500.04013.79
5.2.170.0330.03712.56
5.2.160.0300.03012.56
5.2.150.0470.03012.56
5.2.140.0530.04712.56
5.2.130.0400.02312.56
5.2.120.0430.05712.56
5.2.110.0400.04012.56
5.2.100.0470.03312.56
5.2.90.0400.05012.56
5.2.80.0400.03312.56
5.2.70.0370.04712.56
5.2.60.0400.02712.56
5.2.50.0370.06012.56
5.2.40.0270.03012.56
5.2.30.0330.02712.56
5.2.20.0370.05312.56
5.2.10.0330.03012.56
5.2.00.0430.04312.56
5.1.60.0300.04012.56
5.1.50.0330.03712.56
5.1.40.0300.03012.56
5.1.30.0430.04012.56
5.1.20.0330.03312.56
5.1.10.0300.03312.56
5.1.00.0430.02312.56
5.0.50.0230.04012.56
5.0.40.0170.04312.56
5.0.30.0200.04012.56
5.0.20.0230.02712.56
5.0.10.0130.03012.56
5.0.00.0270.02312.56
4.4.90.0230.03012.56
4.4.80.0170.01312.56
4.4.70.0200.01712.56
4.4.60.0170.01312.56
4.4.50.0170.02012.56
4.4.40.0200.05012.56
4.4.30.0200.03012.56
4.4.20.0170.02712.56
4.4.10.0200.02012.56
4.4.00.0200.02712.56
4.3.110.0170.02012.56
4.3.100.0170.02012.56
4.3.90.0130.02712.56
4.3.80.0130.02312.56
4.3.70.0130.01312.56
4.3.60.0130.01312.56
4.3.50.0100.01712.56
4.3.40.0070.02712.56
4.3.30.0030.01712.56
4.3.20.0070.01312.56
4.3.10.0030.01712.56
4.3.00.0100.01312.56

preferences:
39.44 ms | 401 KiB | 5 Q