3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); ini_set('display_errors', 1); class system_tags { function __call($name, $params) { return '(TAG "' . $name . '" WAS HERE)'; } } class App { function run() { // Prerequisites. $system_tags = new system_tags(); $core = new \stdClass(); $core->tags = array( 'hello' => 'test1', 'world' => 'test2', ); $this->template = 'Blah blah {hello} blah blah {world}.'; $this->withStrReplace($core, $system_tags); $this->template = 'Blah blah {hello} blah blah {world}.'; $this->withRegexReplaceCallback($core, $system_tags); } function withStrReplace($core, $system_tags) { foreach($core->tags as $tag_name => $tag_method) { $this->template = str_replace( '{' . $tag_name . '}', $system_tags->{$tag_method}(), $this->template ); } } function withRegexReplaceCallback($core, $system_tags) { $callback = static function ($matches) use (& $tag_method, $system_tags) { return $system_tags->{$tag_method}(); }; foreach($core->tags as $tag_name => $tag_method) { $this->template = preg_replace_callback( '/\{' . preg_quote($tag_name) . '\}/', $callback, $this->template ); } echo $this->template . "\n<br>"; } } $app = new App(); $app->run();

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.00417.00
8.3.50.0160.00522.07
8.3.40.0150.00018.98
8.3.30.0110.00419.04
8.3.20.0090.00020.39
8.3.10.0040.00421.73
8.3.00.0060.00319.75
8.2.180.0140.00416.63
8.2.170.0030.01722.96
8.2.160.0110.00320.36
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0040.00419.66
8.2.110.0030.00619.13
8.2.100.0060.00617.75
8.2.90.0050.00319.08
8.2.80.0030.00517.97
8.2.70.0000.00817.75
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0100.00018.16
8.2.30.0040.00418.13
8.2.20.0040.00417.78
8.2.10.0050.00318.25
8.2.00.0030.00617.95
8.1.280.0110.00725.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0090.00024.02
8.1.230.0090.00318.97
8.1.220.0080.00017.74
8.1.210.0050.00318.77
8.1.200.0000.00917.73
8.1.190.0000.00817.47
8.1.180.0050.00318.10
8.1.170.0040.00420.53
8.1.160.0040.00422.11
8.1.150.0000.00818.85
8.1.140.0000.00817.64
8.1.130.0050.00317.76
8.1.120.0040.00417.70
8.1.110.0040.00417.64
8.1.100.0040.00417.51
8.1.90.0000.00717.59
8.1.80.0000.00717.66
8.1.70.0000.00717.70
8.1.60.0030.00617.70
8.1.50.0040.00417.73
8.1.40.0020.00517.59
8.1.30.0000.00917.79
8.1.20.0000.00917.86
8.1.10.0000.00817.70
8.1.00.0000.00917.71
8.0.300.0020.00518.77
8.0.290.0050.00217.00
8.0.280.0040.00418.49
8.0.270.0030.00317.30
8.0.260.0070.00017.31
8.0.250.0000.00617.14
8.0.240.0000.00717.11
8.0.230.0030.00317.03
8.0.220.0070.00016.94
8.0.210.0040.00416.99
8.0.200.0030.00317.05
8.0.190.0040.00417.13
8.0.180.0000.00717.00
8.0.170.0040.00417.10
8.0.160.0050.00317.05
8.0.150.0000.00716.90
8.0.140.0000.00716.92
8.0.130.0040.00413.45
8.0.120.0040.00416.91
8.0.110.0080.00017.08
8.0.100.0000.00717.11
8.0.90.0070.00017.11
8.0.80.0120.00917.05
8.0.70.0000.00817.10
8.0.60.0080.00017.02
8.0.50.0000.00816.93
8.0.30.0100.01117.29
8.0.20.0060.01217.40
8.0.10.0040.00417.05
8.0.00.0100.00816.87
7.4.330.0030.00315.15
7.4.320.0000.00816.74
7.4.300.0000.00716.78
7.4.290.0000.00716.64
7.4.280.0000.00716.73
7.4.270.0000.00816.76
7.4.260.0000.00716.72
7.4.250.0070.00016.67
7.4.240.0020.00616.82
7.4.230.0070.00016.81
7.4.220.0090.00916.76
7.4.210.0130.00716.66
7.4.200.0040.00416.73
7.4.160.0090.00916.52
7.4.150.0120.01217.40
7.4.140.0090.00917.86
7.4.130.0080.00816.76
7.4.120.0120.00616.71
7.4.110.0150.00416.74
7.4.100.0100.00716.69
7.4.90.0120.00616.47
7.4.80.0040.01319.39
7.4.70.0130.01016.46
7.4.60.0100.00616.55
7.4.50.0000.00816.60
7.4.40.0100.00716.68
7.4.30.0100.01416.83
7.4.00.0050.01115.03
7.3.330.0020.00513.30
7.3.320.0150.00013.45
7.3.310.0080.00016.36
7.3.300.0000.00716.48
7.3.290.0060.01016.41
7.3.280.0110.00516.44
7.3.270.0100.00717.40
7.3.260.0080.01616.43
7.3.250.0100.00716.68
7.3.240.0000.01816.66
7.3.230.0070.01116.57
7.3.210.0030.01316.72
7.3.200.0090.01219.39
7.3.190.0070.01016.70
7.3.180.0060.00916.40
7.3.170.0110.01116.55
7.3.160.0060.01116.62
7.3.120.0070.01115.05
7.3.110.0030.01314.57
7.3.100.0080.00614.79
7.3.90.0100.00314.77
7.3.80.0090.00614.90
7.3.70.0090.00915.15
7.3.60.0090.00614.77
7.3.50.0000.01514.65
7.3.40.0070.01015.04
7.3.30.0040.01114.91
7.3.20.0110.00016.84
7.3.10.0050.00916.85
7.3.00.0070.00516.94
7.2.330.0140.00716.86
7.2.320.0130.01016.73
7.2.310.0060.01016.71
7.2.300.0000.01816.84
7.2.290.0060.01516.91
7.2.250.0030.01415.52
7.2.240.0100.00715.41
7.2.230.0030.01215.07
7.2.220.0060.00915.32
7.2.210.0020.01415.17
7.2.200.0110.00015.45
7.2.190.0080.00415.33
7.2.180.0090.00315.28
7.2.170.0080.00815.45
7.2.130.0030.01117.32
7.2.120.0000.01517.11
7.2.110.0060.00917.10
7.2.100.0040.01017.11
7.2.90.0120.00317.15
7.2.80.0060.00917.00
7.2.70.0090.00616.86
7.2.60.0030.01217.07
7.2.50.0070.00717.11
7.2.40.0140.00016.91
7.2.30.0040.01417.01
7.2.20.0000.01017.25
7.2.10.0060.00916.82
7.2.00.0050.00818.44
7.1.330.0040.01115.92
7.1.320.0040.01116.10
7.1.310.0070.00716.23
7.1.300.0070.00715.77
7.1.290.0050.00916.06
7.1.280.0060.00915.95
7.1.270.0030.01016.00
7.1.260.0040.01115.79
7.1.250.0030.01015.95
7.1.200.0070.00715.99
7.1.100.0100.00618.19
7.1.70.1030.00315.68
7.1.60.0450.01015.80
7.1.50.0570.00715.47
7.1.40.0570.00615.18
7.1.30.0530.00715.42
7.1.20.0560.00715.39
7.1.10.0080.00416.78
7.1.00.0110.00417.07
7.0.200.0460.00315.18
7.0.190.0520.00315.24
7.0.180.0510.00415.18
7.0.170.0500.00615.18
7.0.160.0460.01015.18
7.0.150.0000.01316.43
7.0.140.0150.00016.71
7.0.130.0500.00815.18
7.0.120.0380.00915.18
7.0.110.0360.00915.18
7.0.100.0810.00715.18
7.0.90.0420.00615.18
7.0.80.0360.01215.18
7.0.70.0460.00915.18
7.0.60.0510.00315.18
7.0.50.0620.00315.18
7.0.40.0080.00615.18
7.0.30.0070.00715.09
7.0.20.0060.00615.09
7.0.10.0100.00415.09
7.0.00.0050.00715.09
5.6.300.0030.05420.69
5.6.290.0120.04220.83
5.6.280.0220.04821.02
5.6.270.0130.03721.11
5.6.260.0070.04820.98
5.6.250.0070.04620.82
5.6.240.0070.04620.91
5.6.230.0070.05420.99
5.6.220.0040.04820.82
5.6.210.0090.05521.03
5.6.200.0070.06720.84
5.6.190.0130.03721.03
5.6.180.0110.04320.85
5.6.170.0100.04420.84
5.6.160.0070.07220.95
5.6.150.0070.04420.78
5.6.140.0030.04921.03
5.6.130.0140.03821.00
5.6.120.0130.05121.04
5.6.110.0100.05120.82
5.6.100.0100.04620.98
5.6.90.0030.05120.93
5.6.80.0100.06820.43
5.6.70.0040.04620.43
5.6.60.0100.07320.43
5.6.50.0160.03720.32
5.6.40.0040.04720.41
5.6.30.0130.03820.08
5.6.20.0040.07120.42
5.6.10.0110.03920.23
5.6.00.0040.04720.32
5.5.380.0070.04217.65
5.5.370.0000.04917.64
5.5.360.0030.04517.43
5.5.350.0070.04817.62
5.5.340.0100.03818.09
5.5.330.0100.03818.02
5.5.320.0070.04618.18
5.5.310.0000.05018.09
5.5.300.0100.03718.08
5.5.290.0030.04717.86
5.5.280.0090.05118.09
5.5.270.0070.05118.17
5.5.260.0100.03918.00
5.5.250.0040.05317.91
5.5.240.0030.05217.52
5.5.230.0030.04017.08
5.5.220.0090.03917.39
5.5.210.0030.05617.50
5.5.200.0150.03017.38
5.5.190.0030.04517.18
5.5.180.0030.05117.52
5.5.160.0100.04217.06
5.5.150.0100.03317.47
5.5.140.0120.03317.37
5.5.130.0100.03617.09
5.5.120.0030.04117.40
5.5.110.0060.04017.47
5.5.100.0130.03717.32
5.5.90.0060.03817.42
5.5.80.0040.03917.33
5.5.70.0070.04017.32
5.5.60.0000.04617.08
5.5.50.0070.04317.41
5.5.40.0100.07317.36
5.5.30.0030.05217.33
5.5.20.0030.05217.33
5.5.10.0060.04117.33
5.5.00.0000.04617.25
5.4.450.0160.04319.31
5.4.440.0130.08119.49
5.4.430.0030.04319.24
5.4.420.0070.04119.27
5.4.410.0070.05219.26
5.4.400.0030.04519.06
5.4.390.0030.07619.11
5.4.380.0070.05419.23
5.4.370.0090.03419.05
5.4.360.0100.05919.20
5.4.350.0100.03918.98
5.4.340.0120.04219.04
5.4.320.0060.04218.98
5.4.310.0030.04019.06
5.4.300.0070.03619.24
5.4.290.0130.03619.16
5.4.280.0110.03519.11
5.4.270.0000.04618.94
5.4.260.0030.04019.28
5.4.250.0030.04419.15
5.4.240.0030.04218.89
5.4.230.0070.04018.98
5.4.220.0130.03919.16
5.4.210.0030.04018.97
5.4.200.0060.05419.13
5.4.190.0030.04419.19
5.4.180.0030.04018.97
5.4.170.0130.03318.96
5.4.160.0100.04018.92
5.4.150.0130.04619.20
5.4.140.0060.03816.73
5.4.130.0000.04116.63
5.4.120.0030.03816.64
5.4.110.0100.03216.79
5.4.100.0070.03416.70
5.4.90.0070.03416.55
5.4.80.0060.03616.78
5.4.70.0130.03216.75
5.4.60.0130.04216.72
5.4.50.0130.02816.38
5.4.40.0060.03516.66
5.4.30.0030.04016.56
5.4.20.0100.03916.45
5.4.10.0090.03716.60
5.4.00.0000.05216.05
5.3.290.0070.04015.09
5.3.280.0000.04615.09
5.3.270.0070.03715.09
5.3.260.0070.03915.09
5.3.250.0030.04215.09
5.3.240.0060.03515.09
5.3.230.0070.03615.09
5.3.220.0120.03415.09
5.3.210.0030.04515.09
5.3.200.0120.03415.09
5.3.190.0060.03515.09
5.3.180.0060.03515.09
5.3.170.0000.04215.09
5.3.160.0100.06415.09
5.3.150.0040.03915.09
5.3.140.0070.03815.09
5.3.130.0160.03115.09
5.3.120.0030.04415.09
5.3.110.0090.03715.09
5.3.100.0000.04515.09
5.3.90.0030.04215.09
5.3.80.0030.03915.09
5.3.70.0030.03815.09
5.3.60.0100.03215.09
5.3.50.0030.03815.09
5.3.40.0030.04115.09
5.3.30.0070.03415.09
5.3.20.0060.04415.09
5.3.10.0070.03315.09
5.3.00.0030.04015.09
5.2.170.0030.05215.09
5.2.160.0030.02915.09
5.2.150.0090.02815.09
5.2.140.0070.02715.09
5.2.130.0240.02415.09
5.2.120.0070.03015.09
5.2.110.0040.03315.09
5.2.100.0030.03315.09
5.2.90.0040.02915.09
5.2.80.0070.02715.09
5.2.70.0100.02915.09
5.2.60.0030.03115.09
5.2.50.0030.03315.09
5.2.40.0070.02715.09
5.2.30.0070.03015.09
5.2.20.0000.03315.09
5.2.10.0000.03715.09
5.2.00.0120.03215.09
5.1.60.0100.02415.09
5.1.50.0100.02215.09
5.1.40.0070.02415.09
5.1.30.0000.03315.09
5.1.20.0030.03015.09
5.1.10.0000.03115.09
5.1.00.0030.03015.09
5.0.50.0100.01415.09
5.0.40.0100.01615.09
5.0.30.0000.04115.09
5.0.20.0030.02115.09
5.0.10.0000.02215.09
5.0.00.0030.03215.09
4.4.90.0060.01115.09
4.4.80.0000.01715.09
4.4.70.0030.01615.09
4.4.60.0030.01615.09
4.4.50.0060.01515.09
4.4.40.0060.02515.09
4.4.30.0000.01815.09
4.4.20.0030.01615.09
4.4.10.0090.01515.09
4.4.00.0030.02715.09
4.3.110.0000.02015.09
4.3.100.0000.01915.09
4.3.90.0030.01515.09
4.3.80.0070.02015.09
4.3.70.0030.01515.09
4.3.60.0030.01615.09
4.3.50.0000.01915.09
4.3.40.0030.02315.09
4.3.30.0000.01815.09
4.3.20.0000.01715.09
4.3.10.0000.01915.09
4.3.00.0030.01615.09

preferences:
56.64 ms | 401 KiB | 5 Q