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 ( $producto, $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.00418.68
8.3.50.0050.01221.14
8.3.40.0000.01418.97
8.3.30.0100.00320.21
8.3.20.0040.00420.35
8.3.10.0080.00021.97
8.3.00.0040.00422.34
8.2.180.0070.01516.88
8.2.170.0070.00722.96
8.2.160.0100.00320.52
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0050.00226.16
8.2.120.0040.00420.71
8.2.110.0100.00022.29
8.2.100.0070.00418.03
8.2.90.0080.00017.97
8.2.80.0000.00817.97
8.2.70.0110.00017.50
8.2.60.0060.00318.03
8.2.50.0000.00918.07
8.2.40.0030.00518.30
8.2.30.0000.00719.45
8.2.20.0040.00417.73
8.2.10.0040.00417.82
8.2.00.0040.00417.70
8.1.280.0140.00725.92
8.1.270.0050.00323.99
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0100.00020.86
8.1.230.0000.01120.85
8.1.220.0090.00017.74
8.1.210.0030.00518.80
8.1.200.0000.00917.35
8.1.190.0040.00417.66
8.1.180.0000.00818.10
8.1.170.0040.00418.66
8.1.160.0040.00418.91
8.1.150.0000.00818.66
8.1.140.0050.00217.46
8.1.130.0050.00317.89
8.1.120.0040.00417.51
8.1.110.0040.00417.32
8.1.100.0040.00417.49
8.1.90.0030.00517.54
8.1.80.0030.00317.46
8.1.70.0000.00717.35
8.1.60.0040.00417.61
8.1.50.0050.00317.57
8.1.40.0000.00717.59
8.1.30.0040.00417.63
8.1.20.0000.00917.66
8.1.10.0000.00817.50
8.1.00.0030.00617.57
8.0.300.0040.00420.05
8.0.290.0040.00417.16
8.0.280.0030.00318.39
8.0.270.0000.00817.20
8.0.260.0030.00316.77
8.0.250.0000.00816.91
8.0.240.0030.00617.05
8.0.230.0030.00316.91
8.0.220.0030.00316.84
8.0.210.0030.00516.88
8.0.200.0000.00817.06
8.0.190.0030.00516.92
8.0.180.0030.00317.05
8.0.170.0040.00417.01
8.0.160.0030.00416.92
8.0.150.0040.00416.93
8.0.140.0000.00816.94
8.0.130.0060.00013.36
8.0.120.0040.00416.88
8.0.110.0000.00716.99
8.0.100.0070.00016.85
8.0.90.0040.00416.99
8.0.80.0120.00917.03
8.0.70.0050.00316.82
8.0.60.0040.00417.09
8.0.50.0040.00416.84
8.0.30.0130.00717.03
8.0.20.0100.00817.40
8.0.10.0000.00717.16
8.0.00.0080.01116.67
7.4.330.0060.00016.82
7.4.320.0000.00716.54
7.4.300.0030.00316.60
7.4.290.0000.00716.50
7.4.280.0000.00716.61
7.4.270.0030.00316.62
7.4.260.0030.00313.19
7.4.250.0070.00016.48
7.4.240.0010.00616.63
7.4.230.0000.00716.43
7.4.220.0180.00016.44
7.4.210.0080.00816.57
7.4.200.0070.00016.71
7.4.190.0030.00316.61
7.4.160.0130.00316.66
7.4.150.0140.00417.40
7.4.140.0090.00917.86
7.4.130.0060.01016.56
7.4.120.0110.00516.52
7.4.110.0100.01016.61
7.4.100.0100.00716.48
7.4.90.0140.00416.45
7.4.80.0120.00619.39
7.4.70.0100.00716.64
7.4.60.0030.01416.73
7.4.50.0030.00516.54
7.4.40.0040.01522.77
7.4.30.0130.00516.63
7.4.00.0100.00614.85
7.3.330.0000.00513.43
7.3.320.0060.00013.45
7.3.310.0030.00316.54
7.3.300.0030.00316.43
7.3.290.0080.00616.46
7.3.280.0090.00816.41
7.3.270.0120.01217.40
7.3.260.0140.00316.60
7.3.250.0060.01116.58
7.3.240.0100.00716.64
7.3.230.0190.00316.50
7.3.210.0130.00316.61
7.3.200.0150.00319.39
7.3.190.0070.01116.48
7.3.180.0000.01616.52
7.3.170.0090.00616.43
7.3.160.0160.00616.54
7.3.120.0070.01014.80
7.3.00.0070.00716.73
7.2.330.0090.00916.70
7.2.320.0100.01416.70
7.2.310.0120.01016.78
7.2.300.0130.00316.77
7.2.290.0060.01016.72
7.2.130.0030.01016.97
7.2.120.0070.00717.00
7.2.110.0100.00016.89
7.2.100.0040.00816.71
7.2.90.0030.00916.78
7.2.80.0080.00616.84
7.2.70.0030.01117.10
7.2.60.0020.00916.77
7.2.50.0070.01316.84
7.2.40.0130.00317.05
7.2.30.0070.00717.03
7.2.20.0060.00917.09
7.2.10.0080.00816.81
7.2.00.0040.01118.20
7.1.250.0040.01115.71
7.1.240.0060.00315.77
7.1.230.0110.00415.63
7.1.220.0090.00615.71
7.1.210.0100.00315.89
7.1.200.0070.00615.78
7.1.190.0100.00315.57
7.1.180.0100.00315.92
7.1.170.0100.00715.71
7.1.160.0000.01415.63
7.1.150.0070.00715.82
7.1.140.0030.00715.71
7.1.130.0050.00515.66
7.1.120.0060.00315.82
7.1.110.0070.01015.64
7.1.100.0030.00916.97
7.1.90.0040.01115.98
7.1.80.0030.00815.86
7.1.70.0080.00316.39
7.1.60.0040.01617.43
7.1.50.0050.01116.46
7.1.40.0030.00615.79
7.1.30.0110.00415.81
7.1.20.0040.00415.74
7.1.10.0070.00315.95
7.1.00.0020.02919.17
7.0.330.0070.00315.47
7.0.320.0100.00315.48
7.0.310.0000.01615.58
7.0.300.0040.00815.23
7.0.290.0000.01115.56
7.0.280.0130.00315.47
7.0.270.0030.01015.56
7.0.260.0050.00815.51
7.0.250.0060.00315.41
7.0.240.0000.01515.57
7.0.230.0060.00315.48
7.0.220.0030.00715.53
7.0.210.0030.00615.38
7.0.200.0040.00615.95
7.0.190.0120.00015.25
7.0.180.0040.00815.52
7.0.170.0040.01215.49
7.0.160.0070.00715.45
7.0.150.0100.00315.43
7.0.140.0050.04018.82
7.0.130.0060.00615.58
7.0.120.0060.00615.61
7.0.110.0030.01415.30
7.0.100.0090.02317.74
7.0.90.0110.02017.77
7.0.80.0030.02817.56
7.0.70.0030.02417.62
7.0.60.0070.02717.61
7.0.50.0090.02217.92
7.0.40.0050.02416.92
7.0.30.0030.04116.62
7.0.20.0120.03516.72
7.0.10.0060.02816.81
7.0.00.0040.02716.84
5.6.380.0060.00914.38
5.6.370.0000.01114.35
5.6.360.0070.00714.10
5.6.350.0090.00314.48
5.6.340.0060.00614.46
5.6.330.0070.00714.71
5.6.320.0060.00614.46
5.6.310.0080.00414.55
5.6.300.0090.00314.52
5.6.290.0030.01214.77
5.6.280.0070.03917.91
5.6.270.0060.00614.63
5.6.260.0060.00314.34
5.6.250.0050.02317.54
5.6.240.0050.02517.41
5.6.230.0050.02717.67
5.6.220.0060.02317.52
5.6.210.0040.03117.60
5.6.200.0060.02317.65
5.6.190.0030.04317.65
5.6.180.0080.02617.96
5.6.170.0040.03917.63
5.6.160.0100.03217.91
5.6.150.0060.03817.78
5.6.140.0030.05017.74
5.6.130.0050.04717.81
5.6.120.0070.04417.65
5.6.110.0120.03917.70
5.6.100.0050.04717.62
5.6.90.0040.03917.72
5.6.80.0120.02817.36
5.6.70.0050.03517.34
5.6.60.0030.04017.42
5.6.50.0070.02217.32
5.6.40.0070.04317.39
5.6.30.0090.03917.33
5.6.20.0090.03917.41
5.6.10.0020.04917.32
5.6.00.0070.03717.29
5.5.380.0060.02215.81
5.5.370.0050.02415.87
5.5.360.0050.02315.95
5.5.350.0020.02715.96
5.5.340.0060.02116.24
5.5.330.0030.02516.06
5.5.320.0020.02916.03
5.5.310.0060.02715.98
5.5.300.0060.04516.05
5.5.290.0090.04515.99
5.5.280.0080.04016.16
5.5.270.0050.03516.13
5.5.260.0080.04316.18
5.5.250.0090.03016.03
5.5.240.0070.03315.88
5.5.230.0030.03615.60
5.5.220.0080.04015.72
5.5.210.0070.04015.66
5.5.200.0110.01815.68
5.5.190.0030.04515.72
5.5.180.0020.03215.82
5.5.170.0000.00711.34
5.5.160.0050.04015.71
5.5.150.0030.03815.73
5.5.140.0060.03815.70
5.5.130.0030.04515.81
5.5.120.0050.04115.73
5.5.110.0050.04315.72
5.5.100.0030.04015.68
5.5.90.0040.04215.73
5.5.80.0030.03915.58
5.5.70.0070.04315.63
5.5.60.0150.03515.63
5.5.50.0070.03715.64
5.5.40.0000.02915.66
5.5.30.0080.04015.67
5.5.20.0060.04115.76
5.5.10.0030.04215.65
5.5.00.0070.04415.63
5.4.450.0030.04615.46
5.4.440.0020.05315.37
5.4.430.0080.04315.27
5.4.420.0050.04815.22
5.4.410.0080.03815.40
5.4.400.0030.03515.12
5.4.390.0060.01815.22
5.4.380.0070.04315.24
5.4.370.0120.03715.19
5.4.360.0040.04115.27
5.4.350.0050.04215.23
5.4.340.0020.04615.10
5.4.330.0000.00811.18
5.4.320.0070.04015.15
5.4.310.0070.03515.11
5.4.300.0080.03615.22
5.4.290.0080.03515.06
5.4.280.0050.03515.21
5.4.270.0080.02315.11
5.4.260.0080.03715.19
5.4.250.0130.03515.17
5.4.240.0110.03515.07
5.4.230.0070.03415.11
5.4.220.0030.03815.06
5.4.210.0060.02815.04
5.4.200.0100.03115.18
5.4.190.0070.03715.13
5.4.180.0070.03015.13
5.4.170.0070.03715.10
5.4.160.0050.02315.00
5.4.150.0020.03915.15
5.4.140.0080.03513.78
5.4.130.0060.03313.88
5.4.120.0030.03013.82
5.4.110.0080.03813.79
5.4.100.0070.03513.86
5.4.90.0060.03713.85
5.4.80.0080.03313.90
5.4.70.0060.03813.85
5.4.60.0070.03213.75
5.4.50.0010.04113.71
5.4.40.0070.03513.86
5.4.30.0080.03313.81
5.4.20.0070.04013.81
5.4.10.0080.03213.74
5.4.00.0080.02813.53
5.3.290.0030.03512.94
5.3.280.0000.03112.96
5.3.270.0080.04012.89
5.3.260.0050.03712.94
5.3.250.0020.04212.93
5.3.240.0020.04212.86
5.3.230.0070.03512.88
5.3.220.0080.03112.85
5.3.210.0050.04012.89
5.3.200.0070.03512.95
5.3.190.0030.03812.94
5.3.180.0070.03712.94
5.3.170.0050.03712.84
5.3.160.0030.02312.93
5.3.150.0050.03812.88
5.3.140.0050.04012.86
5.3.130.0050.02512.94
5.3.120.0000.02512.83
5.3.110.0050.04212.90
5.3.100.0030.04012.59
5.3.90.0080.03812.63
5.3.80.0080.03812.55
5.3.70.0070.03812.64
5.3.60.0070.03912.55
5.3.50.0040.02412.62
5.3.40.0080.03812.64
5.3.30.0020.03512.60
5.3.20.0080.03512.47
5.3.10.0100.03212.47
5.3.00.0030.03612.43
5.2.170.0060.03011.22
5.2.160.0020.02111.18
5.2.150.0080.02811.21
5.2.140.0070.03011.12
5.2.130.0080.02111.20
5.2.120.0080.02811.19
5.2.110.0030.02711.21
5.2.100.0070.01511.19
5.2.90.0010.02111.19
5.2.80.0050.03111.07
5.2.70.0070.03011.11
5.2.60.0000.03711.06
5.2.50.0030.03111.13
5.2.40.0060.03111.13
5.2.30.0090.02511.11
5.2.20.0030.02811.14
5.2.10.0030.01811.08
5.2.00.0040.03111.01
5.1.60.0020.03010.62
5.1.50.0060.02710.61
5.1.40.0020.02510.62
5.1.30.0040.03010.75
5.1.20.0030.02110.74
5.1.10.0080.02310.61
5.1.00.0030.02610.67
5.0.50.0030.02510.61
5.0.40.0030.02310.61
5.0.30.0060.02910.61
5.0.20.0040.02210.61
5.0.10.0020.02410.61
5.0.00.0020.03410.61
4.4.90.0000.01610.61
4.4.80.0020.02110.61
4.4.70.0020.01910.61
4.4.60.0030.01010.61
4.4.50.0040.00810.61
4.4.40.0030.02610.61
4.4.30.0020.01810.61
4.4.20.0000.02010.61
4.4.10.0050.01510.61
4.4.00.0000.02810.61
4.3.110.0010.01610.61
4.3.100.0000.01410.61
4.3.90.0030.01010.61
4.3.80.0020.01610.61
4.3.70.0000.01910.61
4.3.60.0020.02210.61
4.3.50.0000.02010.61
4.3.40.0020.02710.61
4.3.30.0020.01810.61
4.3.20.0000.02210.61
4.3.10.0010.01110.61
4.3.00.0020.01310.61

preferences:
46.75 ms | 401 KiB | 5 Q