3v4l.org

run code in 300+ PHP versions simultaneously
<?php class friendList { private $friends; public function __construct(array $names){ $this->friends = array(); if($names) foreach($names as $name) $this->addFriend($name); } public function addFriend($name) { $this->friends[] = $name; } public function getFriends() { return $this->friends; } } $friends = new friendList(array('Eric','Dan','Lisa')); function funtimes($friends) { echo implode(", ", $friends->getFriends()) . "\n"; $friends->addFriend('John'); } funtimes($friends); var_dump($friends); $funtimes2 = function() use ($friends) { echo implode(", ", $friends->getFriends()) . "\n"; $friends->addFriend('Mark'); }; $funtimes2(); var_dump($friends);

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.0040.01116.50
8.3.50.0170.00122.99
8.3.40.0140.00718.79
8.3.30.0070.00719.17
8.3.20.0080.00020.38
8.3.10.0070.00023.64
8.3.00.0000.00817.75
8.2.180.0090.00616.75
8.2.170.0040.01222.96
8.2.160.0070.01020.17
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0040.00420.71
8.2.110.0040.00420.43
8.2.100.0080.00418.16
8.2.90.0030.00619.17
8.2.80.0080.00017.97
8.2.70.0060.00317.63
8.2.60.0080.00018.04
8.2.50.0040.00418.07
8.2.40.0000.00817.62
8.2.30.0000.00818.25
8.2.20.0050.00317.81
8.2.10.0000.00818.13
8.2.00.0060.00317.63
8.1.280.0180.00325.92
8.1.270.0100.00623.96
8.1.260.0070.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00722.19
8.1.230.0070.00419.09
8.1.220.0080.00017.79
8.1.210.0000.00818.77
8.1.200.0070.00317.10
8.1.190.0030.00517.35
8.1.180.0030.00618.10
8.1.170.0060.00318.71
8.1.160.0070.00022.04
8.1.150.0050.00218.86
8.1.140.0000.00717.48
8.1.130.0030.00517.82
8.1.120.0000.00717.50
8.1.110.0080.00017.39
8.1.100.0000.00717.38
8.1.90.0040.00417.45
8.1.80.0000.00717.46
8.1.70.0050.00317.40
8.1.60.0030.00617.45
8.1.50.0000.00817.52
8.1.40.0030.00617.56
8.1.30.0000.00817.65
8.1.20.0040.00417.50
8.1.10.0030.00617.56
8.1.00.0040.00417.56
8.0.300.0070.00018.77
8.0.290.0000.00816.75
8.0.280.0000.00718.36
8.0.270.0000.00717.18
8.0.260.0000.00717.27
8.0.250.0040.00316.95
8.0.240.0000.00716.85
8.0.230.0070.00016.82
8.0.220.0000.00716.86
8.0.210.0030.00316.89
8.0.200.0030.00517.00
8.0.190.0070.00016.85
8.0.180.0040.00416.93
8.0.170.0040.00416.82
8.0.160.0000.00716.79
8.0.150.0000.00816.84
8.0.140.0030.00516.77
8.0.130.0030.00313.30
8.0.120.0070.00016.84
8.0.110.0040.00416.82
8.0.100.0000.00716.92
8.0.90.0030.00316.81
8.0.80.0080.00716.78
8.0.70.0040.00416.73
8.0.60.0040.00416.77
8.0.50.0070.00016.90
8.0.30.0130.00817.12
8.0.20.0080.01417.40
8.0.10.0040.00416.91
8.0.00.0160.00716.85
7.4.330.0050.00015.05
7.4.320.0040.00416.65
7.4.300.0000.00616.53
7.4.290.0000.00716.46
7.4.280.0030.00716.52
7.4.270.0030.00316.54
7.4.260.0030.00616.49
7.4.250.0030.00616.59
7.4.240.0030.00316.54
7.4.230.0000.00716.58
7.4.220.0070.01116.56
7.4.210.0070.00716.56
7.4.200.0070.00016.49
7.4.160.0060.01116.59
7.4.150.0080.01117.40
7.4.140.0080.00817.86
7.4.130.0110.00816.48
7.4.120.0100.00816.61
7.4.110.0130.00316.65
7.4.100.0140.00316.49
7.4.90.0040.01416.54
7.4.80.0130.00719.39
7.4.70.0040.01916.48
7.4.60.0100.01016.48
7.4.50.0040.00416.36
7.4.40.0060.01216.63
7.4.30.0030.01416.54
7.4.00.0090.00614.91
7.3.330.0050.00213.17
7.3.320.0030.00313.25
7.3.310.0050.00216.34
7.3.300.0000.00716.18
7.3.290.0070.00716.30
7.3.280.0090.00916.29
7.3.270.0140.00517.40
7.3.260.0070.01316.50
7.3.250.0070.01216.50
7.3.240.0060.01216.32
7.3.230.0060.01016.39
7.3.210.0130.00516.73
7.3.200.0110.00619.39
7.3.190.0100.00616.51
7.3.180.0070.00716.37
7.3.170.0170.00416.55
7.3.160.0100.00716.50
7.2.330.0100.00716.48
7.2.320.0110.00716.70
7.2.310.0140.00916.84
7.2.300.0080.00816.81
7.2.290.0070.01116.52
7.2.60.0040.01217.04
7.2.00.0000.00919.13
7.1.200.0060.00615.76
7.1.100.0030.01018.36
7.1.70.0000.01017.19
7.1.60.0030.01919.40
7.1.50.0030.00917.02
7.1.00.0030.07722.45
7.0.200.0100.00715.02
7.0.140.0000.06722.10
7.0.60.0130.07719.95
7.0.50.0070.08017.90
7.0.40.0100.05320.30
7.0.30.0330.08320.23
7.0.20.0300.07320.10
7.0.10.0030.04320.12
7.0.00.0100.08320.12
5.6.280.0030.07321.05
5.6.210.0030.07020.70
5.6.200.0070.05318.19
5.6.190.0130.08020.47
5.6.180.0170.07020.57
5.6.170.0300.06320.54
5.6.160.0100.07320.50
5.6.150.0030.03718.18
5.6.140.0070.07718.28
5.6.130.0000.04718.29
5.6.120.0070.08321.00
5.6.110.0170.07021.13
5.6.100.0030.06021.01
5.6.90.0170.07020.98
5.6.80.0130.07720.49
5.5.350.4000.04020.39
5.5.340.0070.08017.96
5.5.330.0100.05320.29
5.5.320.0400.07720.52
5.5.310.0200.03720.24
5.5.300.0030.07018.09
5.5.290.0170.08018.06
5.5.280.0070.04020.89
5.5.270.0070.03720.68
5.5.260.0070.03720.68
5.5.250.0070.03720.47
5.5.240.0270.07720.27
5.4.450.0230.05319.46
5.4.440.1200.03019.32
5.4.430.0330.03719.55
5.4.420.0300.04019.54
5.4.410.0130.05019.28
5.4.400.0100.04719.20
5.4.390.0200.03719.00
5.4.380.0470.07018.84
5.4.370.0330.05318.73
5.4.360.0870.04718.70
5.4.350.0270.06318.75
5.4.340.0330.06018.51
5.4.320.0100.03112.51
5.4.310.0100.03712.51
5.4.300.0060.03712.51
5.4.290.0030.04112.51
5.4.280.0050.03612.41
5.4.270.0080.03612.40
5.4.260.0110.05212.41
5.4.250.0070.05312.41
5.4.240.0080.03912.41
5.4.230.0060.04812.40
5.4.220.0090.04412.40
5.4.210.0100.04312.40
5.4.200.0090.03512.39
5.4.190.0060.03912.39
5.4.180.0070.03612.39
5.4.170.0080.04612.40
5.4.160.0070.03612.39
5.4.150.0060.04312.39
5.4.140.0070.03912.08
5.4.130.0110.03712.07
5.4.120.0090.03412.02
5.4.110.0090.05012.01
5.4.100.0060.03912.02
5.4.90.0090.03612.02
5.4.80.0040.03912.02
5.4.70.0060.03912.01
5.4.60.0090.03512.01
5.4.50.0040.03812.01
5.4.40.0090.03512.00
5.4.30.0090.03212.00
5.4.20.0050.04812.00
5.4.10.0070.03811.99
5.4.00.0040.03711.48
5.3.290.0050.04012.80
5.3.280.0060.04212.71
5.3.270.0110.05312.72
5.3.260.0070.04212.72
5.3.250.0110.05412.72
5.3.240.0090.05012.72
5.3.230.0120.05712.71
5.3.220.0110.07512.68
5.3.210.0100.08012.68
5.3.200.0090.04112.68
5.3.190.0080.03812.68
5.3.180.0060.04012.67
5.3.170.0050.04112.67
5.3.160.0090.04212.68
5.3.150.0130.04912.67
5.3.140.0060.04212.66
5.3.130.0070.03912.66
5.3.120.0070.03912.66
5.3.110.0070.04112.66
5.3.100.0070.04112.13
5.3.90.0080.03612.11
5.3.80.0060.03812.10
5.3.70.0070.03812.10
5.3.60.0100.04012.09
5.3.50.0060.03712.03
5.3.40.0040.03912.03
5.3.30.0090.04811.99
5.3.20.0090.03911.77
5.3.10.0080.04111.74
5.3.00.0060.04111.73
5.2.170.0120.0349.23
5.2.160.0090.0289.23
5.2.150.0070.0379.23
5.2.140.0080.0399.23
5.2.130.0070.0379.19
5.2.120.0050.0299.19
5.2.110.0090.0249.20
5.2.100.0050.0289.19
5.2.90.0090.0389.19
5.2.80.0070.0439.18
5.2.70.0060.0379.18
5.2.60.0090.0409.14
5.2.50.0050.0309.11
5.2.40.0050.0289.09
5.2.30.0060.0289.06
5.2.20.0080.0259.05
5.2.10.0030.0298.95
5.2.00.0040.0308.82
5.1.60.0030.0278.10
5.1.50.0100.0298.10
5.1.40.0030.0258.08
5.1.30.0050.0268.43
5.1.20.0060.0268.45
5.1.10.0050.0288.18
5.1.00.0110.0198.17
5.0.50.0060.0216.64
5.0.40.0020.0236.51
5.0.30.0040.0356.32
5.0.20.0050.0186.28
5.0.10.0020.0216.26
5.0.00.0020.0316.25
4.4.90.0030.0154.78
4.4.80.0050.0134.75
4.4.70.0030.0154.76
4.4.60.0020.0164.75
4.4.50.0040.0144.77
4.4.40.0030.0324.71
4.4.30.0020.0274.76
4.4.20.0080.0324.84
4.4.10.0030.0234.85
4.4.00.0060.0264.76
4.3.110.0060.0254.67
4.3.100.0010.0214.66
4.3.90.0040.0234.63
4.3.80.0030.0304.58
4.3.70.0060.0174.63
4.3.60.0050.0284.63
4.3.50.0050.0174.63
4.3.40.0040.0234.54
4.3.30.0010.0173.30
4.3.20.0000.0183.28
4.3.10.0020.0163.24
4.3.00.0000.01315.62

preferences:
44.46 ms | 401 KiB | 5 Q