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 ) { echo $cantidad; $cadena += $producto . "\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->what_inside_cart (); //echo $mi_carro->productos[0];

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.0140.00318.56
8.3.50.0200.00816.40
8.3.40.0090.00618.79
8.3.30.0140.00018.61
8.3.20.0050.00318.77
8.3.10.0000.00820.48
8.3.00.0060.00317.63
8.2.180.0140.00316.63
8.2.170.0150.00322.96
8.2.160.0100.00322.08
8.2.150.0000.00824.18
8.2.140.0050.00224.66
8.2.130.0000.00826.16
8.2.120.0040.00419.95
8.2.110.0000.00921.01
8.2.100.0090.00318.03
8.2.90.0000.00719.25
8.2.80.0030.00617.97
8.2.70.0030.00617.63
8.2.60.0040.00418.05
8.2.50.0060.00318.07
8.2.40.0000.00718.28
8.2.30.0040.00418.08
8.2.20.0000.00817.75
8.2.10.0040.00417.72
8.2.00.0050.00317.71
8.1.280.0090.01225.92
8.1.270.0040.00423.99
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0100.00721.25
8.1.230.0070.00420.92
8.1.220.0040.00418.77
8.1.210.0040.00418.87
8.1.200.0070.00317.47
8.1.190.0000.00817.63
8.1.180.0000.00918.10
8.1.170.0050.00318.71
8.1.160.0050.00218.94
8.1.150.0000.00718.69
8.1.140.0000.00717.49
8.1.130.0000.00717.78
8.1.120.0000.00717.57
8.1.110.0000.00717.58
8.1.100.0040.00417.57
8.1.90.0090.00017.53
8.1.80.0040.00417.55
8.1.70.0000.00817.52
8.1.60.0040.00417.63
8.1.50.0030.00517.41
8.1.40.0040.00417.61
8.1.30.0000.00717.66
8.1.20.0000.00817.60
8.1.10.0060.00317.50
8.1.00.0000.00817.56
8.0.300.0000.00719.90
8.0.290.0000.00716.63
8.0.280.0030.00318.39
8.0.270.0000.00817.28
8.0.260.0000.00718.72
8.0.250.0040.00416.97
8.0.240.0040.00417.05
8.0.230.0000.00716.93
8.0.220.0070.00017.03
8.0.210.0050.00217.01
8.0.200.0030.00316.93
8.0.190.0070.00017.07
8.0.180.0070.00017.04
8.0.170.0040.00417.04
8.0.160.0040.00416.88
8.0.150.0000.00816.82
8.0.140.0100.00016.96
8.0.130.0030.00713.37
8.0.120.0070.00016.91
8.0.110.0040.00416.80
8.0.100.0000.00817.04
8.0.90.0040.00416.88
8.0.80.0090.00617.00
8.0.70.0040.00416.93
8.0.60.0000.00716.98
8.0.50.0000.00716.94
8.0.30.0110.01116.91
8.0.20.0080.01017.18
8.0.10.0080.00017.00
8.0.00.0100.00816.76
7.4.330.0000.00514.78
7.4.320.0000.00616.44
7.4.300.0030.00316.50
7.4.290.0000.00716.52
7.4.280.0060.00316.43
7.4.270.0070.00016.54
7.4.260.0050.00013.30
7.4.250.0050.00316.40
7.4.240.0050.00216.53
7.4.230.0030.00416.51
7.4.220.0080.01216.46
7.4.210.0070.00716.56
7.4.200.0040.00416.43
7.4.190.0000.00716.56
7.4.160.0110.00716.73
7.4.150.0120.00917.07
7.4.140.0160.00617.20
7.4.130.0100.01016.58
7.4.120.0110.00716.62
7.4.110.0160.00616.60
7.4.100.0140.00316.60
7.4.90.0090.01216.49
7.4.80.0090.00918.80
7.4.70.0060.01116.58
7.4.60.0090.00916.38
7.4.50.0060.00316.68
7.4.40.0120.00622.27
7.4.30.0070.01016.67
7.4.00.0090.00614.97
7.3.330.0060.00013.38
7.3.320.0000.00513.47
7.3.310.0050.00316.32
7.3.300.0040.00416.54
7.3.290.0140.00016.33
7.3.280.0090.00616.42
7.3.270.0110.01117.07
7.3.260.0060.01418.24
7.3.250.0090.01016.43
7.3.240.0140.00316.42
7.3.230.0060.01616.59
7.3.210.0160.00316.68
7.3.200.0130.00319.39
7.3.190.0100.01016.50
7.3.180.0030.01316.67
7.3.170.0100.00616.57
7.3.160.0090.00616.67
7.3.120.0130.00314.93
7.2.330.0130.00316.70
7.2.320.0110.00716.50
7.2.310.0090.00916.51
7.2.300.0100.00716.81
7.2.290.0060.01316.39
7.2.60.0030.01317.00
7.1.200.0100.00315.71
7.1.70.0080.00816.99
7.1.60.0140.01019.40
7.1.50.0060.01617.11
7.1.00.0030.07722.43
7.0.200.0000.00816.63
7.0.140.0100.06322.07
7.0.60.0070.03720.03
7.0.50.0070.04317.96
7.0.40.0100.06017.76
7.0.30.0070.07317.74
7.0.20.0000.07017.75
7.0.10.0000.08717.78
7.0.00.0030.08317.74
5.6.280.0070.07020.93
5.6.210.0070.08020.54
5.6.200.0130.07718.18
5.6.190.0170.06718.27
5.6.180.0100.07718.14
5.6.170.0030.05018.13
5.6.160.0000.05318.25
5.6.150.0070.08018.25
5.6.140.0030.04018.17
5.6.130.0130.07318.16
5.6.120.0130.07018.12
5.6.110.0030.08718.18
5.6.100.0130.03318.20
5.6.90.0030.04318.27
5.6.80.0070.06317.63
5.6.70.0100.08017.57
5.6.60.0070.04717.53
5.6.50.0070.04717.61
5.6.40.0130.07017.48
5.6.30.0030.04017.64
5.6.20.0130.06317.50
5.6.10.0030.07717.63
5.6.00.0070.09017.59
5.5.350.0170.08320.54
5.5.340.0070.04717.93
5.5.330.0100.08318.05
5.5.320.0030.08017.96
5.5.310.0030.04018.07
5.5.300.0030.08017.98
5.5.290.0070.08317.95
5.5.280.0000.05717.98
5.5.270.0130.04318.07
5.5.260.0030.06718.00
5.5.250.0070.05017.77
5.5.240.0000.04317.32
5.5.230.0030.06317.37
5.5.220.0030.06317.32
5.5.210.0070.08017.43
5.5.200.0030.08317.31
5.5.190.0030.05317.31
5.5.180.0030.05017.40
5.5.160.0070.05717.33
5.5.150.0070.07017.34
5.5.140.0000.04317.36
5.5.130.0170.06717.40
5.5.120.0070.08017.42
5.5.110.0030.05017.27
5.5.100.0030.04717.32
5.5.90.0030.04717.20
5.5.80.0070.07717.18
5.5.70.0130.06717.32
5.5.60.0030.06017.23
5.5.50.0000.04317.29
5.5.40.0070.07317.21
5.5.30.0100.05017.19
5.5.20.0100.07717.22
5.5.10.0100.07317.18
5.5.00.0200.03017.19
5.4.450.0130.07719.39
5.4.440.0000.08719.42
5.4.430.0100.06719.41
5.4.420.0070.04019.41
5.4.410.0130.07019.08
5.4.400.0100.07319.06
5.4.390.0100.07719.11
5.4.380.0100.03719.04
5.4.370.0100.04719.05
5.4.360.0070.03719.10
5.4.350.0000.06019.05
5.4.340.0070.07319.03
5.4.320.0070.04319.13
5.4.310.0130.03319.02
5.4.300.0070.06719.01
5.4.290.0100.08019.09
5.4.280.0070.06719.27
5.4.270.0100.04019.05
5.4.260.0170.06319.14
5.4.250.0030.04319.27
5.4.240.0130.07019.09
5.4.230.0100.06319.10
5.4.220.0070.08019.04
5.4.210.0100.08019.14
5.4.200.0030.06719.03
5.4.190.0100.06319.00
5.4.180.0200.04719.09
5.4.170.0070.04019.06
5.4.160.0070.08319.00
5.4.150.0070.05319.25
5.4.140.0070.07716.59
5.4.130.0070.04716.34
5.4.120.0100.07316.49
5.4.110.0070.07316.52
5.4.100.0030.08016.43
5.4.90.0030.07016.64
5.4.80.0170.06316.50
5.4.70.0030.06016.42
5.4.60.0070.07716.21
5.4.50.0100.03316.43
5.4.40.0070.07016.43
5.4.30.0100.03016.27
5.4.20.0030.03716.39
5.4.10.0030.03716.36
5.4.00.0000.03715.68
5.3.290.0070.05314.69
5.3.280.0000.08014.62
5.3.270.0070.06314.66
5.3.260.0100.07314.72
5.3.250.0070.07014.69
5.3.240.0100.04014.64
5.3.230.0070.07314.63
5.3.220.0030.05014.65
5.3.210.0200.05714.68
5.3.200.0070.07714.64
5.3.190.0000.05314.61
5.3.180.0030.06714.55
5.3.170.0100.04314.54
5.3.160.0070.08014.62
5.3.150.0070.07714.65
5.3.140.0070.05314.78
5.3.130.0070.03714.55
5.3.120.0030.03714.57
5.3.110.0100.03014.57
5.3.100.0000.03714.10
5.3.90.0000.04314.13
5.3.80.0030.03714.01
5.3.70.0000.04014.07
5.3.60.0030.05013.90
5.3.50.0070.03713.97
5.3.40.0070.03314.17
5.3.30.0000.03713.82
5.3.20.0000.03713.72
5.3.10.0070.03013.70
5.3.00.0000.04013.67
5.2.170.0030.03011.18
5.2.160.0070.02311.16
5.2.150.0030.02711.14
5.2.140.0000.03311.21
5.2.130.0000.03011.10
5.2.120.0100.02011.07
5.2.110.0030.02711.01
5.2.100.0100.02011.14
5.2.90.0030.02711.15
5.2.80.0000.03010.98
5.2.70.0070.03010.94
5.2.60.0000.03011.09
5.2.50.0030.03011.09
5.2.40.0000.03011.10
5.2.30.0000.03011.03
5.2.20.0100.02011.06
5.2.10.0030.02710.83
5.2.00.0000.03310.69
5.1.60.0000.02310.07
5.1.50.0030.0239.99
5.1.40.0030.02010.04
5.1.30.0030.02310.40
5.1.20.0030.03310.38
5.1.10.0030.02310.16
5.1.00.0030.02310.02
5.0.50.0030.0178.46
5.0.40.0000.0208.39
5.0.30.0000.0308.39
5.0.20.0030.0178.39
5.0.10.0100.0238.39
5.0.00.0030.0638.39
4.4.90.0030.0108.39
4.4.80.0000.0138.39
4.4.70.0000.0178.39
4.4.60.0000.0138.39
4.4.50.0000.0138.39
4.4.40.0000.0238.39
4.4.30.0000.0138.39
4.4.20.0000.0138.39
4.4.10.0000.0178.39
4.4.00.0000.0238.39
4.3.110.0030.0138.39
4.3.100.0000.0138.39
4.3.90.0000.0138.39
4.3.80.0100.0478.39
4.3.70.0030.0278.39
4.3.60.0000.0378.39
4.3.50.0030.0238.39
4.3.40.0000.0438.39
4.3.30.0030.0138.39
4.3.20.0030.0338.39
4.3.10.0030.0378.39
4.3.00.0000.0308.39

preferences:
40.21 ms | 401 KiB | 5 Q