3v4l.org

run code in 300+ PHP versions simultaneously
<?php // This is the best that you can do in PHP without going into the weird // self-modifying code because of this: // https://wiki.php.net/rfc/uniform_variable_syntax // I've inclued two ways of doing it, one using concat (.) and one using method // calls (->). If the UVS thing passes we can replace the the zero-width space // in the Container class w/ an __invoke() call and all will be well. class Container { private $current_string = "g"; public function __invoke($str = null) { if ($str !== null) { return $this->current_string . $str; } $this->current_string .= "o"; return $this; } } function gg($str = null) { if ($str === "al") { return "gal"; } return new Container(); } function g($str = null) { return "g" . $str; } function ​($str = null) { return $str ?: "o"; } return gg()()("al");

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.0150.00016.63
8.3.50.0100.00921.97
8.3.40.0140.00018.78
8.3.30.0070.00719.27
8.3.20.0040.00420.29
8.3.10.0080.00021.73
8.3.00.0040.00417.77
8.2.180.0140.00416.63
8.2.170.0070.00722.96
8.2.160.0070.00720.57
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0050.00321.02
8.2.110.0000.00920.93
8.2.100.0040.00817.72
8.2.90.0000.00817.91
8.2.80.0040.00417.97
8.2.70.0000.00817.25
8.2.60.0040.00418.04
8.2.50.0080.00018.07
8.2.40.0050.00318.22
8.2.30.0050.00318.24
8.2.20.0040.00417.64
8.2.10.0070.00018.04
8.2.00.0080.00017.68
8.1.280.0100.00725.92
8.1.270.0030.00623.79
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00620.68
8.1.230.0070.00320.84
8.1.220.0000.00817.74
8.1.210.0000.00918.84
8.1.200.0050.00517.25
8.1.190.0000.00817.35
8.1.180.0050.00318.10
8.1.170.0090.00018.63
8.1.160.0000.00721.95
8.1.150.0080.00018.78
8.1.140.0050.00317.47
8.1.130.0040.00417.84
8.1.120.0040.00417.49
8.1.110.0000.00817.39
8.1.100.0050.00317.38
8.1.90.0000.00817.44
8.1.80.0040.00417.47
8.1.70.0040.00417.44
8.1.60.0030.00517.65
8.1.50.0030.00617.43
8.1.40.0070.00017.55
8.1.30.0000.00817.53
8.1.20.0090.00017.55
8.1.10.0000.00817.47
8.1.00.0040.00417.51
8.0.300.0050.00319.85
8.0.290.0000.00916.75
8.0.280.0070.00018.47
8.0.270.0030.00317.23
8.0.260.0000.00617.25
8.0.250.0070.00017.00
8.0.240.0050.00316.99
8.0.230.0000.00716.96
8.0.220.0030.00316.81
8.0.210.0040.00416.89
8.0.200.0060.00016.85
8.0.190.0040.00417.00
8.0.180.0040.00416.84
8.0.170.0050.00316.83
8.0.160.0040.00417.04
8.0.150.0040.00416.74
8.0.140.0030.00316.89
8.0.130.0040.00413.36
8.0.120.0050.00216.77
8.0.110.0070.00016.88
8.0.100.0000.00716.76
8.0.90.0070.00016.70
8.0.80.0060.00916.95
8.0.70.0000.00716.71
8.0.60.0050.00216.85
8.0.50.0050.00316.89
8.0.30.0080.01117.03
8.0.20.0150.00417.40
8.0.10.0040.00416.95
8.0.00.0080.00916.71
7.4.330.0030.00215.19
7.4.320.0030.00316.50
7.4.300.0000.00716.61
7.4.290.0000.00716.66
7.4.280.0040.00416.50
7.4.270.0040.00416.53
7.4.260.0070.00016.50
7.4.250.0040.00416.38
7.4.240.0000.00716.48
7.4.230.0030.00316.26
7.4.220.0030.01416.70
7.4.210.0070.00716.51
7.4.200.0000.00716.42
7.4.160.0110.00416.60
7.4.150.0080.00817.40
7.4.140.0150.00417.86
7.4.130.0100.00716.54
7.4.120.0120.00416.47
7.4.110.0090.00916.45
7.4.100.0100.00716.65
7.4.90.0080.00916.45
7.4.80.0120.00619.39
7.4.70.0130.00316.51
7.4.60.0180.00016.48
7.4.50.0050.00216.59
7.4.40.0070.01016.46
7.4.30.0100.00816.42
7.4.00.0030.01014.88
7.3.330.0000.00613.19
7.3.320.0000.00513.18
7.3.310.0060.00016.33
7.3.300.0000.00716.27
7.3.290.0130.00716.35
7.3.280.0070.01216.34
7.3.270.0150.00317.40
7.3.260.0090.00916.41
7.3.250.0080.01616.46
7.3.240.0100.01016.53
7.3.230.0160.00016.50
7.3.210.0120.01016.50
7.3.200.0090.00919.39
7.3.190.0090.00916.52
7.3.180.0070.01116.69
7.3.170.0120.00816.39
7.3.160.0120.00316.22
7.3.120.0100.00714.84
7.3.10.0070.00716.73
7.3.00.0060.00316.52
7.2.330.0070.01016.47
7.2.320.0060.01216.57
7.2.310.0100.00716.45
7.2.300.0090.01216.75
7.2.290.0060.01016.70
7.2.130.0040.01117.02
7.2.120.0040.00816.78
7.2.110.0070.00716.84
7.2.100.0030.00916.86
7.2.90.0120.00316.87
7.2.80.0040.01316.58
7.2.70.0030.01316.59
7.2.60.0050.01016.91
7.2.50.0070.00716.73
7.2.40.0000.01117.00
7.2.30.0030.01016.73
7.2.20.0070.00316.68
7.2.10.0060.00317.03
7.2.00.0090.00318.16
7.1.250.0000.00815.93
7.1.200.0060.00315.88
7.1.100.0060.00617.73
7.1.70.0070.00717.28
7.1.60.0070.01719.70
7.1.50.0030.01417.04
7.1.00.0030.07722.28
7.0.200.0030.00616.81
7.0.140.0000.07322.01
7.0.60.0000.08019.95
7.0.50.0000.08017.92
7.0.40.0030.09020.09
7.0.30.0130.05720.29
7.0.20.0270.05320.03
7.0.10.0070.04320.13
7.0.00.0070.08020.14
5.6.280.0070.07021.14
5.6.210.0000.06720.48
5.6.200.0030.08018.20
5.6.190.0130.07720.48
5.6.180.0270.07320.64
5.6.170.0170.05320.71
5.6.160.0100.08020.48
5.6.150.0170.06318.19
5.6.140.0130.07318.12
5.6.130.0030.04318.13
5.6.120.0100.03320.96
5.6.110.0100.08021.14
5.6.100.0130.07720.99
5.6.90.0030.08321.01
5.6.80.0030.03720.55
5.5.350.0000.04320.33
5.5.340.0130.06318.04
5.5.330.0070.04720.21
5.5.320.0070.07720.36
5.5.310.0270.07720.41
5.5.300.0030.08318.01
5.5.290.0070.07717.94
5.5.280.0000.09720.78
5.5.270.0030.04320.86
5.5.260.0200.07320.80
5.5.250.0100.05320.67
5.5.240.0170.08020.13
5.4.450.0500.05019.55
5.4.440.0270.03719.55
5.4.430.1530.02019.54
5.4.420.1130.03319.40
5.4.410.1430.04319.39
5.4.400.0270.03019.25
5.4.390.0900.04318.88
5.4.380.0270.06018.75
5.4.370.0400.05018.73
5.4.360.0330.04718.63
5.4.350.0400.04718.76
5.4.340.0370.05018.59
5.4.320.0030.04012.53
5.4.310.0150.05912.52
5.4.300.0130.04512.53
5.4.290.0080.06012.52
5.4.280.0120.04712.41
5.4.270.0170.04212.42
5.4.260.0030.06012.42
5.4.250.0090.05212.41
5.4.240.0060.05112.41
5.4.230.0120.04712.41
5.4.220.0110.04812.41
5.4.210.0100.06512.41
5.4.200.0080.05312.41
5.4.190.0100.05112.41
5.4.180.0110.05112.40
5.4.170.0080.05012.41
5.4.160.0100.04712.40
5.4.150.0030.05012.40
5.4.140.0100.04312.09
5.4.130.0110.04512.07
5.4.120.0050.04112.04
5.4.110.0060.04112.03
5.4.100.0110.05012.03
5.4.90.0080.04912.03
5.4.80.0070.04112.04
5.4.70.0060.03812.03
5.4.60.0070.03812.04
5.4.50.0060.03912.04
5.4.40.0070.03912.02
5.4.30.0110.03412.02
5.4.20.0090.03612.01
5.4.10.0040.04012.02
5.4.00.0080.05311.51
5.3.290.0060.04612.80
5.3.280.0060.05812.71
5.3.270.0110.06012.72
5.3.260.0110.04712.72
5.3.250.0090.04312.72
5.3.240.0060.04012.72
5.3.230.0080.04012.71
5.3.220.0090.05012.68
5.3.210.0110.04912.68
5.3.200.0110.05312.68
5.3.190.0130.05512.68
5.3.180.0090.05612.67
5.3.170.0120.05012.67
5.3.160.0100.05612.68
5.3.150.0130.05912.67
5.3.140.0130.04712.66
5.3.130.0090.06312.65
5.3.120.0090.05512.66
5.3.110.0070.05412.65
5.3.100.0090.05112.13
5.3.90.0160.07612.11
5.3.80.0170.05312.10
5.3.70.0100.04812.10
5.3.60.0070.04912.09
5.3.50.0090.04512.03
5.3.40.0090.05112.03
5.3.30.0060.03712.00
5.3.20.0070.04911.78
5.3.10.0080.04911.74
5.3.00.0070.05011.72
5.2.170.0060.0419.23
5.2.160.0030.0349.22
5.2.150.0060.0319.23
5.2.140.0070.0339.22
5.2.130.0080.0309.18
5.2.120.0050.0309.18
5.2.110.0060.0339.19
5.2.100.0060.0389.19
5.2.90.0050.0309.19
5.2.80.0080.0399.19
5.2.70.0110.0429.18
5.2.60.0070.0429.14
5.2.50.0090.0399.11
5.2.40.0140.0499.09
5.2.30.0070.0459.06
5.2.20.0100.0379.05
5.2.10.0090.0428.96
5.2.00.0090.0358.82
5.1.60.0080.0288.10
5.1.50.0160.0368.10
5.1.40.0100.0408.08
5.1.30.0050.0368.43
5.1.20.0080.0338.45
5.1.10.0060.0378.18
5.1.00.0060.0408.18
5.0.50.0050.0276.65
5.0.40.0070.0266.52
5.0.30.0070.0366.32
5.0.20.0110.0286.29
5.0.10.0080.0266.27
5.0.00.0030.0336.27
4.4.90.0030.0224.78
4.4.80.0050.0194.75
4.4.70.0040.0214.76
4.4.60.0040.0234.75
4.4.50.0060.0204.77
4.4.40.0080.0304.71
4.4.30.0080.0194.76
4.4.20.0050.0234.85
4.4.10.0060.0304.85
4.4.00.0080.0344.76
4.3.110.0070.0204.67
4.3.100.0120.0274.66
4.3.90.0060.0214.63
4.3.80.0030.0344.58
4.3.70.0060.0194.63
4.3.60.0030.0214.63
4.3.50.0050.0154.63
4.3.40.0030.0334.53
4.3.30.0060.0183.30
4.3.20.0040.0213.28
4.3.10.0020.0223.23
4.3.00.0130.02714.93

preferences:
49.94 ms | 401 KiB | 5 Q