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 '(METHOD "' . $name . '" WAS CALLED WITH PARAMS ' . implode(', ', $params) . ')'; } } class App { function run() { // Prerequisites. $system_tags = new system_tags(); $core = new \stdClass(); $core->tags = array( 'hello' => 'tagHelloMethod(1, 2)', 'world' => 'tagWorldMethod(3, 4)', ); // Approach 1. $this->template = 'Blah blah {hello} blah blah {world}.'; $this->withStrReplace($core, $system_tags); echo $this->template . "\n"; // Approach 2. $this->template = 'Blah blah {hello} blah blah {world}.'; $this->withRegexReplaceCallback($core, $system_tags); echo $this->template . "\n"; } function withStrReplace($core, $system_tags) { foreach($core->tags as $tag_name => $tag_method) { $this->template = str_replace( '{' . $tag_name . '}', eval('$system_tags->' . $tag_method . ';'), $this->template ); } } function withRegexReplaceCallback($core, $system_tags) { $callback = static function ($matches) use (& $tag_method, $system_tags) { return eval('$system_tags->' . $tag_method . ';'); }; foreach($core->tags as $tag_name => $tag_method) { $this->template = preg_replace_callback( '/\{' . preg_quote($tag_name) . '\}/', $callback, $this->template ); } } } $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.0000.01517.11
8.3.50.0130.00722.08
8.3.40.0090.00619.18
8.3.30.0080.00819.01
8.3.20.0040.00420.20
8.3.10.0000.00921.90
8.3.00.0080.00419.63
8.2.180.0130.00617.25
8.2.170.0110.00422.96
8.2.160.0070.00720.53
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00419.79
8.2.110.0030.00619.36
8.2.100.0080.00417.75
8.2.90.0000.00819.28
8.2.80.0040.00417.97
8.2.70.0030.00617.75
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0000.00918.22
8.2.30.0030.00518.11
8.2.20.0030.00617.99
8.2.10.0080.00018.06
8.2.00.0000.00817.98
8.1.280.0110.01125.92
8.1.270.0060.00320.70
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0100.00022.32
8.1.230.0060.00617.48
8.1.220.0000.00917.74
8.1.210.0030.00618.77
8.1.200.0030.00617.73
8.1.190.0000.00817.60
8.1.180.0040.00418.10
8.1.170.0000.00920.55
8.1.160.0060.00322.14
8.1.150.0040.00418.84
8.1.140.0050.00317.51
8.1.130.0070.00017.93
8.1.120.0050.00217.63
8.1.110.0000.00717.70
8.1.100.0000.00717.51
8.1.90.0040.00417.62
8.1.80.0000.00717.66
8.1.70.0000.00717.66
8.1.60.0000.00817.80
8.1.50.0040.00417.61
8.1.40.0040.00417.59
8.1.30.0080.00017.74
8.1.20.0040.00417.80
8.1.10.0040.00417.58
8.1.00.0080.00017.53
8.0.300.0000.00718.77
8.0.290.0090.00017.00
8.0.280.0050.00218.54
8.0.270.0030.00317.26
8.0.260.0060.00017.30
8.0.250.0000.00717.04
8.0.240.0070.00017.18
8.0.230.0070.00017.16
8.0.220.0040.00417.04
8.0.210.0040.00417.03
8.0.200.0030.00317.16
8.0.190.0050.00317.14
8.0.180.0040.00417.06
8.0.170.0040.00417.06
8.0.160.0090.00017.05
8.0.150.0070.00016.98
8.0.140.0040.00417.03
8.0.130.0000.00713.55
8.0.120.0040.00416.92
8.0.110.0040.00417.13
8.0.100.0040.00416.96
8.0.90.0000.00816.95
8.0.80.0070.01617.03
8.0.70.0000.00717.11
8.0.60.0000.00816.97
8.0.50.0050.00216.96
8.0.30.0160.00917.31
8.0.20.0110.01117.40
8.0.10.0040.00416.99
8.0.00.0080.00916.95
7.4.330.0000.00515.07
7.4.320.0040.00416.76
7.4.300.0030.00316.75
7.4.290.0080.00016.78
7.4.280.0050.00316.63
7.4.270.0070.00016.89
7.4.260.0030.00316.72
7.4.250.0000.00716.78
7.4.240.0060.00116.78
7.4.230.0000.00716.84
7.4.220.0120.00916.76
7.4.210.0100.00616.84
7.4.200.0040.00416.84
7.4.160.0000.01916.72
7.4.150.0110.00717.40
7.4.140.0130.00817.86
7.4.130.0100.01116.73
7.4.120.0070.01116.74
7.4.110.0070.01816.65
7.4.100.0150.00316.84
7.4.90.0040.01616.87
7.4.80.0130.00719.39
7.4.70.0060.01616.73
7.4.60.0100.00716.45
7.4.50.0030.00316.79
7.4.40.0060.01016.64
7.4.30.0100.01316.58
7.4.00.0050.01115.08
7.3.330.0030.00313.25
7.3.320.0150.00013.27
7.3.310.0030.00616.51
7.3.300.0030.00316.52
7.3.290.0080.00816.48
7.3.280.0100.00916.47
7.3.270.0140.00317.40
7.3.260.0090.00916.59
7.3.250.0090.00816.65
7.3.240.0050.01316.84
7.3.230.0130.02216.63
7.3.210.0030.01316.43
7.3.200.0100.01019.39
7.3.190.0090.00616.66
7.3.180.0130.00316.78
7.3.170.0070.01416.71
7.3.160.0120.00316.52
7.3.120.0070.01314.97
7.3.110.0030.01414.98
7.3.100.0100.01014.82
7.3.90.0060.00914.88
7.3.80.0040.01214.93
7.3.70.0060.00314.82
7.3.60.0030.00714.83
7.3.50.0120.00315.00
7.3.40.0030.00615.13
7.3.30.0090.00615.14
7.3.20.0090.00616.72
7.3.10.0090.00516.40
7.3.00.0110.00616.87
7.2.330.0120.00916.75
7.2.320.0130.00316.91
7.2.310.0060.01817.00
7.2.300.0130.00417.02
7.2.290.0040.01416.78
7.2.250.0070.01315.50
7.2.240.0030.01615.26
7.2.230.0100.00615.03
7.2.220.0080.00615.35
7.2.210.0000.01415.39
7.2.200.0060.00615.21
7.2.190.0030.01015.29
7.2.180.0140.00015.42
7.2.170.0060.01215.39
7.2.160.0080.00314.96
7.2.150.0070.01017.12
7.2.140.0120.00316.89
7.2.130.0030.01216.96
7.2.120.0080.00817.18
7.2.110.0130.00517.06
7.2.100.0150.00817.05
7.2.90.0120.00717.15
7.2.80.0060.00916.96
7.2.70.0030.01416.98
7.2.60.0080.00816.92
7.2.50.0060.00916.95
7.2.40.0080.01116.97
7.2.30.0070.00917.08
7.2.20.0080.00816.93
7.2.10.0090.00516.98
7.2.00.0050.01018.03
7.1.330.0090.00915.79
7.1.320.0060.00916.07
7.1.310.0040.00816.06
7.1.300.0070.00715.64
7.1.290.0030.00716.20
7.1.280.0080.00615.89
7.1.270.0100.00316.14
7.1.260.0040.00415.98
7.1.250.0120.00915.83
7.1.240.0040.00815.95
7.1.230.0070.00716.11
7.1.220.0040.00415.65
7.1.210.0040.00815.93
7.1.200.0080.01015.80
7.1.190.0030.00615.84
7.1.180.0060.01016.06
7.1.170.0070.00715.96
7.1.160.0100.00316.10
7.1.150.0000.01416.07
7.1.140.0110.00416.07
7.1.130.0000.00815.99
7.1.120.0030.01016.15
7.1.110.0090.00615.77
7.1.100.0090.00617.22
7.1.90.0040.01115.74
7.1.80.0070.01015.70
7.1.70.0020.01016.60
7.1.60.0120.00817.85
7.1.50.0030.01216.59
7.1.40.0100.00315.93
7.1.30.0060.00815.98
7.1.20.0080.00616.08
7.1.10.0030.01016.09
7.1.00.0030.04119.15
7.0.330.0060.00915.68
7.0.320.0060.00615.74
7.0.310.0040.01115.55
7.0.300.0060.00315.65
7.0.290.0070.00715.45
7.0.280.0040.01115.85
7.0.270.0070.00715.50
7.0.260.0030.00915.62
7.0.250.0060.00615.49
7.0.240.0080.00615.62
7.0.230.0030.00915.80
7.0.220.0110.00315.77
7.0.210.0090.00315.71
7.0.200.0050.01015.26
7.0.190.0030.00715.45
7.0.180.0030.01015.59
7.0.170.0120.00015.33
7.0.160.0100.00315.47
7.0.150.0150.00015.64
7.0.140.0020.04318.83
7.0.130.0030.00615.73
7.0.120.0030.01015.62
7.0.110.0070.04517.89
7.0.100.0120.04017.65
7.0.90.0080.03817.75
7.0.80.0070.04017.83
7.0.70.0020.05217.92
7.0.60.0050.04517.72
7.0.50.0090.04018.07
7.0.40.0030.04716.95
7.0.30.0120.03716.92
7.0.20.0080.04216.79
7.0.10.0030.03316.99
7.0.00.0020.03517.00
5.6.400.0060.00314.68
5.6.390.0110.00414.55
5.6.380.0060.00914.67
5.6.370.0060.00614.26
5.6.360.0090.00314.47
5.6.350.0030.01014.45
5.6.340.0090.00614.15
5.6.330.0120.00414.59
5.6.320.0030.01214.39
5.6.310.0000.01114.25
5.6.300.0090.00014.45
5.6.290.0090.00614.59
5.6.280.0050.03917.88
5.6.270.0090.00614.33
5.6.260.0030.01214.67
5.6.250.0030.04917.54
5.6.240.0090.04017.61
5.6.230.0070.04417.65
5.6.220.0090.05117.64
5.6.210.0120.03817.65
5.6.200.0080.04217.75
5.6.190.0020.04917.86
5.6.180.0030.04117.81
5.6.170.0090.03917.82
5.6.160.0110.03817.71
5.6.150.0070.02917.88
5.6.140.0050.05017.91
5.6.130.0070.03117.93
5.6.120.0030.03217.78
5.6.110.0030.04617.68
5.6.100.0050.04617.82
5.6.90.0070.04417.91
5.6.80.0030.02517.47
5.6.70.0050.04317.50
5.6.60.0090.03517.57
5.6.50.0040.04417.37
5.6.40.0050.04217.50
5.6.30.0110.04017.33
5.6.20.0100.02417.34
5.6.10.0030.04717.41
5.6.00.0100.04017.38
5.5.380.0080.04017.46
5.5.370.0070.04217.31
5.5.360.0150.03017.34
5.5.350.0050.03317.54
5.5.340.0050.04517.65
5.5.330.0060.04617.64
5.5.320.0120.04217.79
5.5.310.0070.04217.71
5.5.300.0050.04517.65
5.5.290.0080.04217.68
5.5.280.0130.02517.75
5.5.270.0050.04417.51
5.5.260.0050.04217.62
5.5.250.0030.04917.39
5.5.240.0030.03117.35
5.5.230.0050.04617.21
5.5.220.0030.04717.35
5.5.210.0050.04617.22
5.5.200.0040.02617.37
5.5.190.0110.04017.46
5.5.180.0050.04617.39
5.5.170.0140.00014.48
5.5.160.0070.03217.38
5.5.150.0090.04217.42
5.5.140.0020.04217.23
5.5.130.0100.03917.38
5.5.120.0050.04517.42
5.5.110.0080.03417.21
5.5.100.0080.04217.13
5.5.90.0070.04517.29
5.5.80.0100.03017.24
5.5.70.0090.03717.38
5.5.60.0090.03917.23
5.5.50.0060.04617.21
5.5.40.0030.02517.31
5.5.30.0030.02517.34
5.5.20.0070.04017.15
5.5.10.0090.04017.10
5.5.00.0110.04017.13
5.4.450.0070.03915.37
5.4.440.0080.04515.35
5.4.430.0130.02315.30
5.4.420.0070.05015.53
5.4.410.0030.04215.32
5.4.400.0090.03315.03
5.4.390.0050.04515.21
5.4.380.0000.04215.02
5.4.370.0050.04214.92
5.4.360.0050.03615.32
5.4.350.0020.04415.19
5.4.340.0080.03415.27
5.4.330.0000.00811.12
5.4.320.0050.03515.24
5.4.310.0060.03214.92
5.4.300.0070.03515.06
5.4.290.0080.03715.36
5.4.280.0030.04415.08
5.4.270.0070.03615.02
5.4.260.0030.04415.33
5.4.250.0040.04415.04
5.4.240.0110.03814.97
5.4.230.0070.03715.13
5.4.220.0050.02915.21
5.4.210.0120.03515.20
5.4.200.0060.03915.32
5.4.190.0090.03215.11
5.4.180.0050.03115.02
5.4.170.0040.03915.24
5.4.160.0080.03815.14
5.4.150.0060.03815.09
5.4.140.0080.03613.91
5.4.130.0050.03913.73
5.4.120.0030.04113.74
5.4.110.0040.03713.94
5.4.100.0030.04013.84
5.4.90.0050.03913.84
5.4.80.0020.02713.77
5.4.70.0100.03513.85
5.4.60.0050.04013.83
5.4.50.0070.02013.68
5.4.40.0050.03513.87
5.4.30.0050.03913.89
5.4.20.0080.03513.73
5.4.10.0020.02813.84
5.4.00.0050.04113.47
5.3.290.0070.08014.83
5.3.280.0070.08014.59
5.3.270.0070.06014.86
5.3.260.0070.07714.63
5.3.250.0070.08314.63
5.3.240.0070.07314.61
5.3.230.0170.05014.71
5.3.220.0070.07714.60
5.3.210.0100.07014.73
5.3.200.0030.07014.60
5.3.190.0170.06314.59
5.3.180.0100.07314.58
5.3.170.0130.07014.46
5.3.160.0070.06314.72
5.3.150.0000.07714.60
5.3.140.0000.07714.43
5.3.130.0100.07314.60
5.3.120.0170.07014.70
5.3.110.0030.06014.71
5.3.100.0100.05314.05
5.3.90.0100.07014.04
5.3.80.0070.07314.11
5.3.70.0030.04314.26
5.3.60.0070.06314.01
5.3.50.0100.07313.94
5.3.40.0030.04313.97
5.3.30.0030.07313.93
5.3.20.0030.07013.77
5.3.10.0000.06313.80
5.3.00.0070.07013.64
5.2.170.0000.06711.70
5.2.160.0030.04711.70
5.2.150.0130.05311.70
5.2.140.0030.06011.70
5.2.130.0100.06011.70
5.2.120.0000.06311.70
5.2.110.0070.03011.70
5.2.100.0000.06711.70
5.2.90.0000.06311.70
5.2.80.0070.06011.70
5.2.70.0030.06311.70
5.2.60.0000.04311.70
5.2.50.0100.04711.70
5.2.40.0070.06011.70
5.2.30.0030.06311.70
5.2.20.0100.05311.70
5.2.10.0070.06011.70
5.2.00.0030.05711.70
5.1.60.0100.04711.70
5.1.50.0000.05311.70
5.1.40.0070.04311.70
5.1.30.0030.05711.70
5.1.20.0100.05311.70
5.1.10.0070.05311.70
5.1.00.0100.05011.70
5.0.50.0070.04011.70
5.0.40.0030.02311.70
5.0.30.0100.05711.70
5.0.20.0030.04011.70
5.0.10.0100.03011.70
5.0.00.0070.06011.70
4.4.90.0000.03711.70
4.4.80.0070.02011.70
4.4.70.0000.04011.70
4.4.60.0000.04011.70
4.4.50.0030.03311.70
4.4.40.0000.06011.70
4.4.30.0030.03311.70
4.4.20.0030.03711.70
4.4.10.0070.02711.70
4.4.00.0000.05711.70
4.3.110.0100.02711.70
4.3.100.0030.02711.70
4.3.90.0000.03711.70
4.3.80.0070.04711.70
4.3.70.0030.02711.70
4.3.60.0070.02711.70
4.3.50.0070.02711.70
4.3.40.0030.03311.70
4.3.30.0000.04011.70
4.3.20.0000.03311.70
4.3.10.0000.03011.70
4.3.00.0000.03011.70

preferences:
47.53 ms | 401 KiB | 5 Q