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' => 'HELLO!', 'world' => 'WORLD!', ); $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.0120.00316.59
8.3.50.0070.01322.05
8.3.40.0120.00418.90
8.3.30.0120.00319.09
8.3.20.0040.00420.37
8.3.10.0030.00521.60
8.3.00.0040.00419.63
8.2.180.0040.01818.54
8.2.170.0090.00622.96
8.2.160.0070.00720.52
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.76
8.2.110.0050.00519.46
8.2.100.0100.00317.75
8.2.90.0030.00619.08
8.2.80.0060.00317.97
8.2.70.0090.00017.63
8.2.60.0000.00817.80
8.2.50.0050.00318.07
8.2.40.0040.00718.34
8.2.30.0000.00718.19
8.2.20.0040.00417.93
8.2.10.0000.00818.15
8.2.00.0040.00417.78
8.1.280.0030.01625.92
8.1.270.0050.00324.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0090.00023.92
8.1.230.0030.00918.91
8.1.220.0050.00317.91
8.1.210.0080.00018.77
8.1.200.0100.00017.61
8.1.190.0050.00317.46
8.1.180.0050.00318.10
8.1.170.0030.00520.27
8.1.160.0000.00722.05
8.1.150.0000.00818.95
8.1.140.0050.00317.69
8.1.130.0030.00317.88
8.1.120.0000.00717.55
8.1.110.0040.00417.53
8.1.100.0080.00017.63
8.1.90.0000.00717.61
8.1.80.0000.00717.57
8.1.70.0030.00317.55
8.1.60.0040.00417.75
8.1.50.0080.00017.57
8.1.40.0030.00517.66
8.1.30.0060.00317.67
8.1.20.0000.00817.88
8.1.10.0000.00717.74
8.1.00.0090.00017.71
8.0.300.0000.00718.77
8.0.290.0040.00417.13
8.0.280.0000.00818.39
8.0.270.0030.00317.41
8.0.260.0030.00317.35
8.0.250.0030.00317.16
8.0.240.0080.00017.13
8.0.230.0000.00717.04
8.0.220.0050.00316.99
8.0.210.0000.00716.98
8.0.200.0000.00617.11
8.0.190.0040.00417.04
8.0.180.0050.00317.09
8.0.170.0050.00316.97
8.0.160.0000.00917.14
8.0.150.0040.00417.02
8.0.140.0000.00816.95
8.0.130.0000.00713.53
8.0.120.0040.00416.94
8.0.110.0040.00416.98
8.0.100.0040.00417.12
8.0.90.0000.00817.04
8.0.80.0140.00717.03
8.0.70.0040.00417.01
8.0.60.0000.00816.88
8.0.50.0000.00816.87
8.0.30.0140.00817.37
8.0.20.0080.01117.40
8.0.10.0030.00517.06
8.0.00.0080.01016.79
7.4.330.0050.00015.05
7.4.320.0080.00016.79
7.4.300.0040.00416.84
7.4.290.0070.00016.69
7.4.280.0070.00016.82
7.4.270.0070.00016.90
7.4.260.0070.00016.75
7.4.250.0070.00016.70
7.4.240.0050.00316.70
7.4.230.0040.00416.74
7.4.220.0070.01416.84
7.4.210.0040.01116.72
7.4.200.0080.00016.92
7.4.160.0130.01016.76
7.4.150.0140.01717.40
7.4.140.0170.00617.86
7.4.130.0130.00416.76
7.4.120.0110.00616.69
7.4.110.0030.02016.64
7.4.100.0030.01516.69
7.4.90.0170.00716.71
7.4.80.0090.00919.39
7.4.70.0070.01016.45
7.4.60.0060.01116.86
7.4.50.0030.00616.39
7.4.40.0070.01616.72
7.4.30.0090.00916.75
7.4.00.0070.01014.72
7.3.330.0060.00013.45
7.3.320.0150.00013.32
7.3.310.0000.00716.42
7.3.300.0050.00216.36
7.3.290.0100.00416.49
7.3.280.0080.00816.47
7.3.270.0100.00617.40
7.3.260.0170.00616.54
7.3.250.0090.00816.72
7.3.240.0150.00416.86
7.3.230.0110.01116.79
7.3.210.0070.01016.66
7.3.200.0060.01219.39
7.3.190.0060.00916.83
7.3.180.0160.00716.40
7.3.170.0160.00616.45
7.3.160.0130.00316.71
7.2.330.0030.01616.76
7.2.320.0120.01017.02
7.2.310.0110.00716.64
7.2.300.0160.00716.74
7.2.290.0120.01017.07
7.2.60.0100.00317.20
7.2.00.0040.00719.50
7.1.200.0060.01015.99
7.1.100.0080.00818.42
7.1.70.0000.00817.46
7.1.60.0030.01719.50
7.1.50.0110.01117.24
7.1.00.0030.07722.32
7.0.200.0160.00314.96
7.0.140.0070.07321.92
7.0.60.0000.08719.95
7.0.50.0030.04317.75
7.0.40.0070.09320.03
7.0.30.0270.08320.07
7.0.20.0300.06720.24
7.0.10.0230.06720.11
7.0.00.0070.05320.16
5.6.210.0100.05720.65
5.6.200.0100.05318.16
5.6.190.0100.08320.41
5.6.180.0400.07320.53
5.6.170.0300.06320.50
5.6.160.0030.04320.57
5.6.150.0030.05018.21
5.6.140.0070.08018.27
5.6.130.0030.05018.15
5.6.120.0030.08321.06
5.6.110.0100.08720.97
5.6.100.0130.07320.98
5.6.90.0030.04721.11
5.6.80.0070.08320.39
5.6.70.0200.07720.47
5.5.350.0170.07320.46
5.5.340.0070.03717.98
5.5.330.0100.06720.26
5.5.320.0070.04020.28
5.5.310.0330.07720.35
5.5.300.0070.06717.96
5.5.290.0070.04717.93
5.5.280.0000.04320.79
5.5.270.0230.04020.66
5.5.260.0070.06720.75
5.5.250.0070.08320.71
5.5.240.0100.06320.29
5.4.450.0600.05319.61
5.4.440.0870.06719.47
5.4.430.0930.05319.46
5.4.420.0030.05719.19
5.4.410.0900.05319.45
5.4.400.0230.04718.51
5.4.390.0170.05318.75
5.4.380.0230.05018.73
5.4.370.0300.05318.57
5.4.360.0130.07318.73
5.4.350.0170.06018.51
5.4.340.0230.06018.78
5.4.320.0270.07018.71
5.4.310.0300.06018.73
5.4.300.0230.05318.57
5.4.290.0370.04318.71
5.4.280.0130.05718.53
5.4.270.0130.06318.74
5.4.260.0170.05718.82
5.4.250.0200.05718.73
5.4.240.0330.04718.75
5.4.230.0130.06318.57
5.4.220.0270.05018.47
5.4.210.0270.06318.71
5.4.200.0270.04716.63
5.4.190.0300.04718.52
5.4.180.0200.05718.52
5.4.170.0200.05718.70
5.4.160.0300.05018.71
5.4.150.0130.06318.69
5.4.140.0130.06016.45
5.4.130.0130.05716.18
5.4.120.0070.06716.45
5.4.110.0130.06016.20
5.4.100.0230.05016.30
5.4.90.0170.05716.29
5.4.80.0200.05316.23
5.4.70.0270.05016.27
5.4.60.0330.05716.28
5.4.50.0130.05716.30
5.4.40.0130.05716.32
5.4.30.0230.04716.30
5.4.20.0130.06016.43
5.4.10.0130.05716.17
5.4.00.0070.06315.78
5.3.290.0130.07314.84
5.3.280.0200.05014.60
5.3.270.0200.05314.66
5.3.260.0230.04714.70
5.3.250.0200.05014.63
5.3.240.0200.05014.91
5.3.230.0330.04014.74
5.3.220.0330.04314.78
5.3.210.0170.06014.61
5.3.200.0200.05014.63
5.3.190.0270.05714.56
5.3.180.0230.05014.68
5.3.170.0230.05714.75
5.3.160.0130.06014.77
5.3.150.0070.06714.86
5.3.140.0170.05314.66
5.3.130.0300.06714.73
5.3.120.0230.07014.75
5.3.110.0100.08314.84
5.3.100.0300.06314.10
5.3.90.0130.05314.16
5.3.80.0270.06314.07
5.3.70.0300.06014.12
5.3.60.0200.05014.13
5.3.50.0130.05313.95
5.3.40.0270.04714.00
5.3.30.0270.04314.21
5.3.20.0230.05013.82
5.3.10.0300.06013.65
5.3.00.0230.06713.76
5.2.170.0230.04311.27
5.2.160.0300.04311.23
5.2.150.0130.05011.28
5.2.140.0230.04011.21
5.2.130.0170.04311.24
5.2.120.0200.04011.24
5.2.110.0230.04711.15
5.2.100.0230.03711.23
5.2.90.0130.04311.34
5.2.80.0130.04711.23
5.2.70.0100.05011.21
5.2.60.0270.03311.14
5.2.50.0130.04311.11
5.2.40.0100.04311.00
5.2.30.0170.04011.00
5.2.20.0030.05011.00
5.2.10.0100.04310.92
5.2.00.0200.03710.76
5.1.60.0100.03710.19
5.1.50.0170.03010.13
5.1.40.0170.03010.20
5.1.30.0170.04710.40
5.1.20.0170.04010.60
5.1.10.0130.03310.08
5.1.00.0070.04310.13
5.0.50.0070.0308.59
5.0.40.0030.0338.55
5.0.30.0100.0438.42
5.0.20.0100.0278.43
5.0.10.0070.0308.33
5.0.00.0000.0508.23
4.4.90.0000.0275.94
4.4.80.0070.0235.98
4.4.70.0070.0205.95
4.4.60.0100.0175.93
4.4.50.0130.0175.94
4.4.40.0030.0375.90
4.4.30.0070.0235.93
4.4.20.0000.0336.00
4.4.10.0030.0335.95
4.4.00.0100.0335.97
4.3.110.0100.0205.85
4.3.100.0070.0235.85
4.3.90.0070.0205.82
4.3.80.0100.0335.83
4.3.70.0100.0175.94
4.3.60.0130.0175.81
4.3.50.0070.0235.81
4.3.40.0100.0375.80
4.3.30.0100.0204.57
4.3.20.0000.0234.58
4.3.10.0070.0234.55
4.3.00.0170.0177.32

preferences:
37.07 ms | 401 KiB | 5 Q