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('$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.0140.00417.13
8.3.50.0190.00222.06
8.3.40.0000.01419.09
8.3.30.0040.01119.03
8.3.20.0040.00420.33
8.3.10.0030.00622.08
8.3.00.0100.00019.75
8.2.180.0140.00417.00
8.2.170.0110.00722.96
8.2.160.0110.00422.06
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0040.00419.54
8.2.110.0060.00319.14
8.2.100.0110.00017.88
8.2.90.0040.00419.04
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0050.00318.04
8.2.50.0080.00018.07
8.2.40.0000.00818.22
8.2.30.0040.00418.17
8.2.20.0000.00817.98
8.2.10.0000.00918.30
8.2.00.0080.00017.77
8.1.280.0070.01425.92
8.1.270.0060.00320.57
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.31
8.1.230.0080.00417.60
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0040.00417.47
8.1.190.0000.00817.61
8.1.180.0030.00518.10
8.1.170.0070.00318.86
8.1.160.0040.00422.03
8.1.150.0040.00418.88
8.1.140.0040.00417.64
8.1.130.0040.00417.85
8.1.120.0000.00817.61
8.1.110.0030.00617.57
8.1.100.0000.00717.52
8.1.90.0040.00417.63
8.1.80.0040.00417.55
8.1.70.0030.00317.63
8.1.60.0030.00617.80
8.1.50.0030.00617.69
8.1.40.0040.00417.62
8.1.30.0060.00317.85
8.1.20.0030.00617.84
8.1.10.0050.00317.79
8.1.00.0080.00017.59
8.0.300.0040.00418.77
8.0.290.0020.00517.00
8.0.280.0030.00518.47
8.0.270.0070.00017.20
8.0.260.0030.00317.30
8.0.250.0040.00417.18
8.0.240.0060.00017.04
8.0.230.0040.00416.97
8.0.220.0000.00717.09
8.0.210.0030.00317.05
8.0.200.0040.00417.01
8.0.190.0000.00717.10
8.0.180.0040.00417.15
8.0.170.0000.00817.00
8.0.160.0040.00417.17
8.0.150.0000.00817.00
8.0.140.0000.00817.04
8.0.130.0050.00313.45
8.0.120.0050.00316.93
8.0.110.0040.00417.01
8.0.100.0050.00217.18
8.0.90.0000.00716.92
8.0.80.0120.00917.11
8.0.70.0050.00317.01
8.0.60.0070.00017.07
8.0.50.0070.00016.95
8.0.30.0180.00616.98
8.0.20.0100.00917.40
8.0.10.0000.00817.17
8.0.00.0120.00616.88
7.4.330.0050.00015.17
7.4.320.0000.00716.66
7.4.300.0030.00316.79
7.4.290.0040.00416.78
7.4.280.0050.00316.75
7.4.270.0050.00216.77
7.4.260.0070.00016.63
7.4.250.0050.00316.84
7.4.240.0030.00516.75
7.4.230.0000.00716.74
7.4.220.0080.01116.80
7.4.210.0100.00316.81
7.4.200.0080.00016.54
7.4.160.0140.00316.56
7.4.150.0100.00917.40
7.4.140.0070.01717.86
7.4.130.0130.00616.70
7.4.120.0100.00716.83
7.4.110.0120.01216.63
7.4.100.0090.00916.70
7.4.90.0070.01016.73
7.4.80.0070.01419.39
7.4.70.0120.00616.49
7.4.60.0060.01016.74
7.4.50.0030.00316.55
7.4.40.0030.01416.71
7.4.30.0090.00916.58
7.4.00.0030.01415.29
7.3.330.0030.00313.23
7.3.320.0090.00513.40
7.3.310.0070.00016.34
7.3.300.0070.00016.35
7.3.290.0040.01116.47
7.3.280.0090.00916.49
7.3.270.0170.00017.40
7.3.260.0130.01016.69
7.3.250.0080.01116.66
7.3.240.0120.00616.63
7.3.230.0120.00616.48
7.3.210.0060.01216.86
7.3.200.0070.01019.39
7.3.190.0030.01316.62
7.3.180.0100.00616.68
7.3.170.0180.00616.67
7.3.160.0040.01216.73
7.3.120.0080.00414.84
7.3.110.0090.00914.83
7.3.100.0000.01415.02
7.3.90.0000.00814.80
7.3.80.0030.00714.68
7.3.70.0080.00015.15
7.3.60.0030.00714.96
7.3.50.0110.00415.09
7.3.40.0060.00615.07
7.3.30.0000.01115.00
7.3.20.0060.00816.41
7.3.10.0070.00716.70
7.3.00.0050.00516.84
7.2.330.0040.01616.70
7.2.320.0130.00416.73
7.2.310.0110.01316.90
7.2.300.0100.00716.83
7.2.290.0120.01217.03
7.2.240.0040.01415.37
7.2.230.0100.00315.21
7.2.220.0040.01115.47
7.2.210.0030.00715.44
7.2.200.0090.00015.39
7.2.190.0030.01015.30
7.2.180.0030.01215.11
7.2.170.0030.00615.22
7.2.160.0000.01115.39
7.2.150.0000.01216.91
7.2.140.0030.00917.30
7.2.130.0030.01017.16
7.2.120.0080.00517.26
7.2.110.0090.00517.05
7.2.100.0030.00817.09
7.2.90.0090.00517.04
7.2.80.0050.01017.30
7.2.70.0110.00517.14
7.2.60.0060.00817.10
7.2.50.0070.01017.07
7.2.40.0070.00616.85
7.2.30.0020.01016.84
7.2.20.0050.00817.13
7.2.10.0090.00517.10
7.2.00.0060.00917.99
7.1.330.0070.00716.03
7.1.320.0050.00316.24
7.1.310.0080.00316.01
7.1.300.0060.00915.79
7.1.290.0000.01415.86
7.1.280.0060.00616.22
7.1.270.0000.01115.86
7.1.260.0030.01015.85
7.1.250.0080.00515.99
7.1.240.0150.00016.25
7.1.230.0050.00516.09
7.1.220.0030.00715.97
7.1.210.0060.00615.93
7.1.200.0100.00615.76
7.1.190.0120.00316.02
7.1.180.0040.00816.06
7.1.170.0060.00315.92
7.1.160.0060.00315.73
7.1.150.0090.00615.94
7.1.140.0040.01215.81
7.1.130.0000.00916.15
7.1.120.0030.01016.14
7.1.110.0030.01016.15
7.1.100.0080.00616.93
7.1.90.0030.01015.86
7.1.80.0000.01415.99
7.1.70.0040.00716.60
7.1.60.0030.00817.68
7.1.50.0090.01116.55
7.1.40.0080.00816.00
7.1.30.0030.00915.59
7.1.20.0090.00615.63
7.1.10.0060.00815.72
7.1.00.0070.04219.12
7.0.330.0030.00915.64
7.0.320.0000.01215.50
7.0.310.0100.00315.57
7.0.300.0090.00015.33
7.0.290.0050.00815.38
7.0.280.0000.00915.45
7.0.270.0030.01015.29
7.0.260.0000.00915.61
7.0.250.0080.00015.69
7.0.240.0030.01315.27
7.0.230.0100.00715.61
7.0.220.0080.00415.60
7.0.210.0090.00615.47
7.0.200.0140.00315.43
7.0.190.0100.00315.77
7.0.180.0080.00315.79
7.0.170.0090.00615.70
7.0.160.0100.00715.53
7.0.150.0000.01415.64
7.0.140.0060.03718.65
7.0.130.0090.00315.61
7.0.120.0030.00915.66
7.0.110.0060.00915.43
7.0.100.0040.01115.50
7.0.90.0040.00715.62
7.0.80.0040.01115.27
7.0.70.0070.01015.46
7.0.60.0050.04517.76
7.0.50.0050.02316.79
7.0.40.0070.02316.79
7.0.30.0100.02916.80
7.0.20.0190.04016.95
7.0.10.0210.03817.04
7.0.00.0060.02416.92
5.6.380.0030.00914.34
5.6.370.0060.00614.55
5.6.360.0030.00614.40
5.6.350.0120.00014.55
5.6.340.0070.00314.46
5.6.330.0120.00314.53
5.6.320.0060.00614.42
5.6.310.0040.00814.23
5.6.300.0000.01314.58
5.6.290.0060.00614.21
5.6.280.0030.03817.68
5.6.270.0030.00914.62
5.6.260.0040.01014.35
5.6.250.0060.00614.59
5.6.240.0030.00914.26
5.6.230.0060.00614.60
5.6.220.0040.00414.59
5.6.210.0050.04617.59
5.6.200.0030.02716.11
5.6.190.0100.04817.33
5.6.180.0150.03517.40
5.6.170.0200.04017.60
5.6.160.0070.04317.53
5.6.150.0030.03816.24
5.6.140.0070.04516.35
5.6.130.0100.03816.32
5.6.120.0120.03517.73
5.6.110.0100.02817.75
5.6.100.0130.02717.71
5.6.90.0050.04417.59
5.6.80.0070.03817.56
5.6.70.0160.03017.42
5.6.60.0030.01114.50
5.6.50.0110.01114.31
5.6.40.0120.00714.22
5.6.30.0110.01114.40
5.6.20.0030.00914.22
5.6.10.0080.00814.20
5.6.00.0120.00314.36
5.5.380.0060.00611.26
5.5.370.0030.00611.18
5.5.360.0090.00411.18
5.5.350.0170.03715.74
5.5.340.0050.04414.58
5.5.330.0050.02115.82
5.5.320.0080.02615.80
5.5.310.0220.03715.76
5.5.300.0050.04114.58
5.5.290.0050.03214.83
5.5.280.0030.04716.13
5.5.270.0080.04315.99
5.5.260.0080.04115.91
5.5.250.0070.04015.99
5.5.240.0060.03315.69
5.5.230.0030.00611.18
5.5.220.0060.00611.18
5.5.210.0070.00411.24
5.5.200.0030.00911.25
5.5.190.0040.01111.18
5.5.180.0050.00511.31
5.5.170.0050.00811.29
5.5.160.0000.00811.18
5.5.150.0040.00411.18
5.5.140.0000.00911.18
5.5.130.0070.00211.39
5.5.120.0080.00011.18
5.5.110.0060.00311.20
5.5.100.0060.00611.18
5.5.90.0050.00511.18
5.5.80.0030.00811.18
5.5.70.0000.00711.18
5.5.60.0050.00511.18
5.5.50.0030.00311.39
5.5.40.0080.00411.30
5.5.30.0030.00911.18
5.5.20.0000.00911.28
5.5.10.0040.00911.32
5.5.00.0060.00911.18
5.4.450.0470.02815.37
5.4.440.0550.03415.54
5.4.430.0340.02815.41
5.4.420.0400.02815.38
5.4.410.0470.03215.34
5.4.400.0080.03214.98
5.4.390.0080.03114.83
5.4.380.0150.02715.00
5.4.370.0180.02414.96
5.4.360.0130.02614.97
5.4.350.0140.03214.95
5.4.340.0150.02814.94
5.4.330.0110.00011.18
5.4.320.0150.02614.97
5.4.310.0130.02815.00
5.4.300.0090.03014.95
5.4.290.0110.02914.94
5.4.280.0130.02914.86
5.4.270.0100.03214.87
5.4.260.0120.02814.98
5.4.250.0080.03314.85
5.4.240.0120.02814.87
5.4.230.0130.02714.88
5.4.220.0130.03314.93
5.4.210.0160.02414.87
5.4.200.0100.03113.93
5.4.190.0150.02514.88
5.4.180.0080.03215.00
5.4.170.0130.03014.94
5.4.160.0110.03015.00
5.4.150.0130.02614.84
5.4.140.0100.03013.69
5.4.130.0100.02713.78
5.4.120.0100.02913.92
5.4.110.0070.03213.81
5.4.100.0130.02813.84
5.4.90.0070.03513.72
5.4.80.0100.02813.80
5.4.70.0130.02913.78
5.4.60.0080.03313.72
5.4.50.0210.02013.72
5.4.40.0170.02213.73
5.4.30.0070.03213.79
5.4.20.0130.02413.80
5.4.10.0100.02713.70
5.4.00.0190.03013.50
5.3.290.0130.03112.93
5.3.280.0130.03012.89
5.3.270.0120.02712.89
5.3.260.0090.03113.04
5.3.250.0120.02812.94
5.3.240.0080.03212.98
5.3.230.0120.02712.91
5.3.220.0070.03012.98
5.3.210.0080.03112.98
5.3.200.0100.03612.98
5.3.190.0110.03512.90
5.3.180.0190.02512.90
5.3.170.0170.02512.88
5.3.160.0180.03812.90
5.3.150.0180.02312.97
5.3.140.0100.02912.98
5.3.130.0080.03312.90
5.3.120.0050.03612.90
5.3.110.0050.03312.87
5.3.100.0140.03712.64
5.3.90.0050.03012.60
5.3.80.0100.02712.67
5.3.70.0140.02312.63
5.3.60.0080.02812.60
5.3.50.0130.02512.65
5.3.40.0130.02512.65
5.3.30.0070.02812.62
5.3.20.0080.03112.46
5.3.10.0110.02412.45
5.3.00.0070.03512.42
5.2.170.0140.02611.18
5.2.160.0090.02311.19
5.2.150.0080.02411.16
5.2.140.0100.02511.17
5.2.130.0100.02511.17
5.2.120.0100.02211.26
5.2.110.0080.02311.20
5.2.100.0090.02411.19
5.2.90.0100.02911.15
5.2.80.0050.03611.25
5.2.70.0120.03011.17
5.2.60.0080.03211.16
5.2.50.0100.02111.11
5.2.40.0050.02611.16
5.2.30.0100.02011.09
5.2.20.0100.02011.10
5.2.10.0060.02511.05
5.2.00.0030.02711.02
5.1.60.0100.01810.66
5.1.50.0060.02010.69
5.1.40.0060.02010.60
5.1.30.0130.02210.79
5.1.20.0110.02110.80
5.1.10.0070.02010.70
5.1.00.0080.02010.70
5.0.50.0050.0239.98
5.0.40.0050.0169.85
5.0.30.0050.0229.73
5.0.20.0040.0159.71
5.0.10.0100.0129.73
5.0.00.0070.0229.69
4.4.90.0020.0158.60
4.4.80.0020.0158.55
4.4.70.0030.0128.59
4.4.60.0030.0188.53
4.4.50.0060.0148.56
4.4.40.0080.0178.54
4.4.30.0030.0178.54
4.4.20.0050.0158.57
4.4.10.0030.0138.61
4.4.00.0010.0218.55
4.3.110.0070.0148.52
4.3.100.0090.0108.57
4.3.90.0020.0138.49
4.3.80.0060.0188.51
4.3.70.0060.0158.56
4.3.60.0100.0128.50
4.3.50.0050.0158.51
4.3.40.0000.0228.53
4.3.30.0040.0177.94
4.3.20.0030.0137.87
4.3.10.0020.0157.92
4.3.00.0050.0109.25

preferences:
44.31 ms | 401 KiB | 5 Q