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('return $system_tags->' . $tag_method . ';'), $this->template ); } } function withRegexReplaceCallback($core, $system_tags) { $callback = static function ($matches) use (& $tag_method, $system_tags) { return eval('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 ); } } } $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.40.0070.01419.13
8.3.30.0080.00819.04
8.3.20.0040.00420.38
8.3.10.0040.00421.73
8.3.00.0060.00319.50
8.2.170.0060.00922.96
8.2.160.0110.00420.48
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0050.00319.79
8.2.110.0070.00321.09
8.2.100.0030.00917.75
8.2.90.0040.00419.22
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0000.00817.78
8.2.50.0060.00618.07
8.2.40.0000.00818.22
8.2.30.0040.00418.17
8.2.20.0060.00317.93
8.2.10.0000.00818.15
8.2.00.0050.00317.86
8.1.270.0060.00320.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00924.02
8.1.230.0040.00719.05
8.1.220.0000.00817.78
8.1.210.0000.00818.77
8.1.200.0030.00717.48
8.1.190.0030.00617.48
8.1.180.0040.00418.10
8.1.170.0000.01118.88
8.1.160.0000.00722.11
8.1.150.0000.00719.01
8.1.140.0000.00817.65
8.1.130.0030.00317.93
8.1.120.0040.00417.61
8.1.110.0050.00317.64
8.1.100.0040.00417.66
8.1.90.0050.00317.68
8.1.80.0050.00317.65
8.1.70.0000.00717.66
8.1.60.0040.00417.80
8.1.50.0060.00317.69
8.1.40.0000.00917.74
8.1.30.0050.00517.76
8.1.20.0020.00517.80
8.1.10.0030.00517.67
8.1.00.0050.00317.58
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0000.00718.36
8.0.270.0040.00417.32
8.0.260.0040.00417.30
8.0.250.0040.00417.11
8.0.240.0030.00317.19
8.0.230.0040.00417.16
8.0.220.0030.00317.05
8.0.210.0000.00717.05
8.0.200.0000.00717.07
8.0.190.0000.00717.09
8.0.180.0040.00417.12
8.0.170.0000.00717.11
8.0.160.0000.00817.02
8.0.150.0040.00416.92
8.0.140.0030.00617.07
8.0.130.0040.00413.48
8.0.120.0030.00516.99
8.0.110.0040.00417.05
8.0.100.0040.00417.07
8.0.90.0050.00217.05
8.0.80.0090.01517.01
8.0.70.0040.00416.89
8.0.60.0040.00417.09
8.0.50.0070.00017.00
8.0.30.0140.00917.19
8.0.20.0090.01217.47
8.0.10.0020.00517.21
8.0.00.0090.00917.01
7.4.330.0030.00315.22
7.4.320.0040.00416.75
7.4.300.0000.00616.71
7.4.290.0000.00716.74
7.4.280.0000.00716.87
7.4.270.0000.00716.67
7.4.260.0020.00516.71
7.4.250.0040.00416.72
7.4.240.0050.00316.87
7.4.230.0030.00316.75
7.4.220.0140.00616.82
7.4.210.0080.00616.85
7.4.200.0070.00016.83
7.4.160.0070.01016.77
7.4.150.0090.00917.40
7.4.140.0090.01217.86
7.4.130.0100.00816.75
7.4.120.0050.01216.71
7.4.110.0160.00616.70
7.4.100.0150.01816.59
7.4.90.0090.00916.72
7.4.80.0100.00719.39
7.4.70.0120.00616.88
7.4.60.0090.01016.77
7.4.50.0000.00416.86
7.4.40.0100.00716.56
7.4.30.0130.00916.76
7.4.10.0000.01815.30
7.4.00.0070.01115.03
7.3.330.0030.00313.50
7.3.320.0080.00813.47
7.3.310.0000.00716.43
7.3.300.0070.00016.52
7.3.290.0060.00816.47
7.3.280.0090.01316.46
7.3.270.0130.01017.40
7.3.260.0060.01216.64
7.3.250.0130.00816.61
7.3.240.0060.01216.54
7.3.230.0070.01016.81
7.3.210.0030.01316.56
7.3.200.0090.00919.39
7.3.190.0090.00616.57
7.3.180.0080.00816.46
7.3.170.0100.01016.63
7.3.160.0120.00316.54
7.3.130.0080.01214.87
7.3.120.0060.01115.25
7.3.110.0060.01215.02
7.3.100.0070.00715.08
7.3.90.0040.01514.98
7.3.80.0100.00715.04
7.3.70.0060.00915.02
7.3.60.0080.00414.87
7.3.50.0060.00315.02
7.3.40.0070.01015.07
7.3.30.0100.00715.13
7.3.20.0030.00716.97
7.3.10.0050.00816.86
7.3.00.0060.00816.62
7.2.330.0030.01816.65
7.2.320.0090.00916.89
7.2.310.0080.01316.84
7.2.300.0060.01516.84
7.2.290.0120.00616.89
7.2.260.0060.00915.18
7.2.250.0080.00315.48
7.2.240.0080.00815.34
7.2.230.0090.00615.39
7.2.220.0120.00015.05
7.2.210.0090.00615.27
7.2.200.0060.00615.13
7.2.190.0060.00315.21
7.2.180.0090.00315.37
7.2.170.0070.01015.37
7.2.160.0080.00314.89
7.2.150.0000.01116.96
7.2.140.0000.01416.96
7.2.130.0060.00917.19
7.2.120.0060.00617.16
7.2.110.0070.00817.01
7.2.100.0090.00816.95
7.2.90.0050.01117.12
7.2.80.0060.00717.14
7.2.70.0050.00917.26
7.2.60.0080.00617.13
7.2.50.0050.00917.12
7.2.40.0050.01117.24
7.2.30.0060.00817.13
7.2.20.0040.01217.32
7.2.10.0080.00717.14
7.2.00.0040.01117.94
7.1.330.0080.00515.62
7.1.320.0070.01015.92
7.1.310.0070.00716.14
7.1.300.0060.00915.61
7.1.290.0070.00315.73
7.1.280.0090.00616.14
7.1.270.0030.01015.97
7.1.260.0080.00816.14
7.1.250.0020.01015.88
7.1.240.0100.00315.91
7.1.230.0070.00915.87
7.1.220.0070.00615.88
7.1.210.0030.01015.89
7.1.200.0060.00716.04
7.1.190.0040.01016.10
7.1.180.0080.00416.05
7.1.170.0050.00816.10
7.1.160.0030.01216.10
7.1.150.0050.00915.95
7.1.140.0050.00815.94
7.1.130.0050.00816.08
7.1.120.0090.00215.78
7.1.110.0070.00715.94
7.1.100.0100.00816.92
7.1.90.0050.00915.94
7.1.80.0070.00515.99
7.1.70.0070.00316.29
7.1.60.0070.01117.09
7.1.50.0100.00716.33
7.1.40.0070.00916.04
7.1.30.0070.01115.79
7.1.20.0130.00715.91
7.1.10.0100.00615.87
7.1.00.0010.03618.06
7.0.330.0050.00615.47
7.0.320.0120.00315.35
7.0.310.0070.00415.63
7.0.300.0040.01015.59
7.0.290.0080.00415.55
7.0.280.0050.01015.68
7.0.270.0040.01215.58
7.0.260.0060.00915.40
7.0.250.0000.01515.69
7.0.240.0060.00715.73
7.0.230.0060.00715.61
7.0.220.0040.00815.62
7.0.210.0040.00915.57
7.0.200.0070.00716.14
7.0.190.0080.00615.43
7.0.180.0110.00315.73
7.0.170.0010.01115.51
7.0.160.0050.01315.73
7.0.150.0100.00715.61
7.0.140.0060.02917.70
7.0.130.0040.01015.56
7.0.120.0130.00215.64
7.0.110.0080.00615.50
7.0.100.0170.03217.00
7.0.90.0070.02917.01
7.0.80.0120.03117.02
7.0.70.0130.02417.15
7.0.60.0060.03217.10
7.0.50.0090.02117.25
7.0.40.0020.02015.80
7.0.30.0080.02715.76
7.0.20.0040.02315.85
7.0.10.0070.01715.74
7.0.00.0050.02315.89
5.6.400.0070.00714.82
5.6.390.0000.00914.69
5.6.380.0080.00614.54
5.6.370.0060.00714.59
5.6.360.0070.00814.47
5.6.350.0030.01014.31
5.6.340.0080.00414.49
5.6.330.0060.00914.56
5.6.320.0070.00814.22
5.6.310.0090.00614.58
5.6.300.0050.00514.47
5.6.290.0070.00714.54
5.6.280.0080.02716.67
5.6.270.0090.00714.36
5.6.260.0050.00814.58
5.6.250.0070.03016.49
5.6.240.0060.02516.52
5.6.230.0090.02016.58
5.6.220.0130.01916.47
5.6.210.0090.01916.49
5.6.200.0040.02516.65
5.6.190.0070.01816.54
5.6.180.0050.03816.69
5.6.170.0050.03416.64
5.6.160.0020.02316.65
5.6.150.0130.01216.58
5.6.140.0020.02116.67
5.6.130.0020.01916.78
5.6.120.0040.02116.68
5.6.110.0100.01616.58
5.6.100.0060.01716.74
5.6.90.0060.01816.72
5.6.80.0060.01616.28
5.6.70.0090.01216.44
5.6.60.0080.01616.43
5.6.50.0090.01416.31
5.6.40.0050.01816.40
5.6.30.0030.02016.34
5.6.20.0030.01816.39
5.6.10.0000.02216.51
5.6.00.0050.01616.38
5.5.380.0070.01915.42
5.5.370.0040.02415.31
5.5.360.0030.03315.34
5.5.350.0080.02415.42
5.5.340.0040.02315.53
5.5.330.0050.02015.61
5.5.320.0070.02515.62
5.5.310.0050.03015.32
5.5.300.0030.02015.43
5.5.290.0030.01915.52
5.5.280.0030.02115.55
5.5.270.0070.01715.43
5.5.260.0060.01715.66
5.5.250.0040.01915.33
5.5.240.0040.02015.14
5.5.230.0040.01715.29
5.5.220.0020.01615.18
5.5.210.0050.01915.31
5.5.200.0030.01915.20
5.5.190.0100.01315.14
5.5.180.0060.01415.18
5.5.170.0060.00712.91
5.5.160.0020.01915.20
5.5.150.0070.01515.26
5.5.140.0050.01715.38
5.5.130.0070.01615.41
5.5.120.0020.01915.38
5.5.110.0060.01615.24
5.5.100.0080.02615.21
5.5.90.0030.02115.27
5.5.80.0040.01715.20
5.5.70.0040.01915.29
5.5.60.0120.02415.22
5.5.50.0070.03115.12
5.5.40.0030.03415.07
5.5.30.0060.02715.19
5.5.20.0050.03115.11
5.5.10.0030.02915.16
5.5.00.0090.03015.23
5.4.450.0030.01814.51
5.4.440.0040.01814.50
5.4.430.0060.02014.44
5.4.420.0030.01814.38
5.4.410.0020.01614.39
5.4.400.0090.01314.30
5.4.390.0030.01914.38
5.4.380.0030.01514.29
5.4.370.0070.01214.28
5.4.360.0080.01114.38
5.4.350.0030.01814.36
5.4.340.0030.01814.33
5.4.330.0080.00512.02
5.4.320.0060.01514.34
5.4.310.0050.01214.27
5.4.300.0050.01714.27
5.4.290.0050.01514.21
5.4.280.0080.01614.33
5.4.270.0040.01614.38
5.4.260.0100.02514.33
5.4.250.0080.01614.27
5.4.240.0040.02514.38
5.4.230.0040.01514.27
5.4.220.0040.01814.29
5.4.210.0100.01714.42
5.4.200.0040.01814.28
5.4.190.0080.02614.34
5.4.180.0010.01814.35
5.4.170.0070.02514.19
5.4.160.0100.01814.34
5.4.150.0040.02214.27
5.4.140.0070.02713.46
5.4.130.0070.03013.45
5.4.120.0060.02213.45
5.4.110.0050.02413.33
5.4.100.0030.02613.38
5.4.90.0040.01913.50
5.4.80.0080.01513.47
5.4.70.0040.01813.31
5.4.60.0100.02513.48
5.4.50.0060.02813.51
5.4.40.0070.02513.52
5.4.30.0040.02013.51
5.4.20.0070.01413.54
5.4.10.0050.02913.42
5.4.00.0070.01613.28
5.3.290.0060.01912.56
5.3.280.0140.03812.49
5.3.270.0040.04212.49
5.3.260.0080.03812.50
5.3.250.0080.03712.39
5.3.240.0020.03712.29
5.3.230.0030.04212.46
5.3.220.0030.03812.31
5.3.210.0080.04312.47
5.3.200.0080.03812.39
5.3.190.0050.03312.42
5.3.180.0080.03812.43
5.3.170.0100.03712.52
5.3.160.0110.03112.51
5.3.150.0040.03412.56
5.3.140.0020.03912.39
5.3.130.0060.03512.49
5.3.120.0120.03512.53
5.3.110.0040.03012.52
5.3.100.0080.02612.22
5.3.90.0090.02112.33
5.3.80.0080.03712.16
5.3.70.0120.03912.29
5.3.60.0090.04112.20
5.3.50.0080.03812.11
5.3.40.0080.04012.16
5.3.30.0030.02512.00
5.3.20.0070.02012.05
5.3.10.0060.02111.98
5.3.00.0080.04011.89
5.2.170.0060.02311.12
5.2.160.0050.03511.12
5.2.150.0110.02811.12
5.2.140.0040.02111.12
5.2.130.0060.02811.12
5.2.120.0060.01511.12
5.2.110.0020.02011.12
5.2.100.0070.03011.12
5.2.90.0010.02911.12
5.2.80.0040.02511.12
5.2.70.0060.03511.12
5.2.60.0020.03311.12
5.2.50.0070.03311.12
5.2.40.0070.03411.12
5.2.30.0080.02511.12
5.2.20.0100.01811.12
5.2.10.0050.03111.12
5.2.00.0050.03511.12
5.1.60.0050.01811.12
5.1.50.0040.02711.12
5.1.40.0060.01011.12
5.1.30.0030.02511.12
5.1.20.0060.02211.12
5.1.10.0030.02311.12
5.1.00.0030.02811.12
5.0.50.0070.02211.12
5.0.40.0010.01311.12
5.0.30.0030.03511.12
5.0.20.0030.01211.12
5.0.10.0060.02311.12
5.0.00.0060.03511.12
4.4.90.0000.02211.12
4.4.80.0020.01811.12
4.4.70.0020.01311.12
4.4.60.0040.00911.12
4.4.50.0070.01511.12
4.4.40.0020.02611.12
4.4.30.0020.01911.12
4.4.20.0050.01811.12
4.4.10.0030.00811.12
4.4.00.0000.02611.12
4.3.110.0050.01711.12
4.3.100.0070.01711.12
4.3.90.0010.00811.12
4.3.80.0020.01311.12
4.3.70.0020.00911.12
4.3.60.0030.00811.12
4.3.50.0020.01211.12
4.3.40.0020.01511.12
4.3.30.0030.01011.12
4.3.20.0060.00711.12
4.3.10.0020.02111.12
4.3.00.0020.01011.12

preferences:
49.77 ms | 400 KiB | 5 Q