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)'; } } class App { function run() { // Prerequisites. $system_tags = new system_tags(); $core = new \stdClass(); $core->tags = array( 'hello' => 'tagHelloMethod', 'world' => 'tagWorldMethod', ); $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.0150.00016.75
8.3.50.0130.00622.25
8.3.40.0120.00318.91
8.3.30.0000.01519.18
8.3.20.0030.00620.06
8.3.10.0000.00821.76
8.3.00.0040.00419.50
8.2.180.0150.00418.54
8.2.170.0120.00322.96
8.2.160.0100.00320.52
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0050.00319.79
8.2.110.0060.00320.52
8.2.100.0090.00317.84
8.2.90.0040.00419.06
8.2.80.0060.00317.97
8.2.70.0090.00017.88
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0030.00718.16
8.2.30.0040.00418.23
8.2.20.0030.00517.79
8.2.10.0040.00418.16
8.2.00.0000.00817.88
8.1.280.0120.00625.92
8.1.270.0060.00320.64
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0000.01023.84
8.1.230.0000.01124.01
8.1.220.0050.00317.78
8.1.210.0000.00818.77
8.1.200.0050.00517.60
8.1.190.0050.00317.35
8.1.180.0000.00818.10
8.1.170.0030.00620.33
8.1.160.0000.00821.97
8.1.150.0040.00418.89
8.1.140.0000.00717.67
8.1.130.0000.00717.82
8.1.120.0000.00717.68
8.1.110.0080.00017.62
8.1.100.0040.00417.59
8.1.90.0000.00717.55
8.1.80.0080.00017.66
8.1.70.0030.00317.59
8.1.60.0030.00617.81
8.1.50.0030.00517.69
8.1.40.0000.00817.68
8.1.30.0030.00617.85
8.1.20.0030.00517.82
8.1.10.0050.00317.59
8.1.00.0000.00817.58
8.0.300.0060.00318.77
8.0.290.0000.00916.75
8.0.280.0050.00218.38
8.0.270.0000.00717.29
8.0.260.0040.00417.29
8.0.250.0040.00417.11
8.0.240.0030.00317.13
8.0.230.0030.00317.02
8.0.220.0070.00017.05
8.0.210.0000.00717.08
8.0.200.0030.00317.13
8.0.190.0030.00517.06
8.0.180.0000.00816.96
8.0.170.0000.00817.02
8.0.160.0040.00417.09
8.0.150.0040.00416.86
8.0.140.0000.00816.92
8.0.130.0000.00713.53
8.0.120.0040.00417.01
8.0.110.0000.00717.06
8.0.100.0050.00217.08
8.0.90.0000.00716.97
8.0.80.0200.00017.09
8.0.70.0000.00816.87
8.0.60.0050.00216.94
8.0.50.0040.00416.85
8.0.30.0170.01217.40
8.0.20.0050.01617.40
8.0.10.0040.00417.07
8.0.00.0160.00416.84
7.4.330.0000.00515.07
7.4.320.0040.00416.73
7.4.300.0030.00316.84
7.4.290.0000.00816.83
7.4.280.0040.00416.87
7.4.270.0060.00316.75
7.4.260.0000.00716.82
7.4.250.0040.00416.79
7.4.240.0010.00616.80
7.4.230.0070.00016.67
7.4.220.0110.00716.84
7.4.210.0120.00616.63
7.4.200.0040.00416.58
7.4.160.0140.00316.88
7.4.150.0000.01817.40
7.4.140.0150.00417.86
7.4.130.0090.00816.60
7.4.120.0080.01116.63
7.4.110.0130.00716.75
7.4.100.0070.01016.62
7.4.90.0130.00716.52
7.4.80.0070.01019.39
7.4.70.0030.01516.47
7.4.60.0060.01016.96
7.4.50.0060.00316.46
7.4.40.0090.00916.58
7.4.30.0100.01416.69
7.4.00.0140.00015.21
7.3.330.0060.00013.32
7.3.320.0120.00413.32
7.3.310.0000.00816.46
7.3.300.0000.00716.48
7.3.290.0090.00516.44
7.3.280.0070.01016.45
7.3.270.0080.00817.40
7.3.260.0130.00316.55
7.3.250.0070.01016.51
7.3.240.0150.00416.66
7.3.230.0110.00716.83
7.3.210.0130.00316.61
7.3.200.0120.01119.39
7.3.190.0110.00516.73
7.3.180.0090.00916.53
7.3.170.0100.00716.77
7.3.160.0100.00716.72
7.3.10.0140.00615.95
7.3.00.0130.00716.25
7.2.330.0090.01416.98
7.2.320.0000.02116.65
7.2.310.0060.01516.96
7.2.300.0030.01316.91
7.2.290.0100.01016.98
7.2.130.0490.01516.73
7.2.120.0090.00317.18
7.2.110.0310.00916.61
7.2.100.0280.00716.73
7.2.90.0160.00717.29
7.2.80.0090.00917.23
7.2.70.0150.00617.05
7.2.60.0300.00016.96
7.2.50.0260.00717.06
7.2.40.0130.00917.07
7.2.30.0350.01417.21
7.2.20.0130.01016.81
7.2.10.0130.00716.89
7.2.00.0110.00518.36
7.1.250.0200.01015.70
7.1.100.0100.00718.50
7.1.70.0000.00817.22
7.1.60.0120.00319.50
7.1.50.0100.01317.31
7.1.00.0070.07322.55
7.0.200.0060.00314.88
7.0.140.0030.07721.98
7.0.60.0030.05020.05
7.0.50.0030.04017.98
7.0.40.0070.08020.12
7.0.30.0300.08320.14
7.0.20.0200.05720.07
7.0.10.0270.07720.10
7.0.00.0130.03720.11
5.6.280.0000.07321.10
5.6.210.0100.06320.63
5.6.200.0030.08318.18
5.6.190.0070.08720.51
5.6.180.0300.05020.30
5.6.170.0370.03720.71
5.6.160.0030.04320.46
5.6.150.0070.04318.14
5.6.140.0070.09018.14
5.6.130.0070.05718.13
5.6.120.0100.04721.00
5.6.110.0030.09721.11
5.6.100.0100.08021.00
5.6.90.0000.09321.00
5.6.80.0130.07320.54
5.6.70.0270.07320.46
5.5.350.0100.04320.51
5.5.340.0030.04318.08
5.5.330.0100.08020.22
5.5.320.0030.05320.57
5.5.310.0270.08020.32
5.5.300.0170.07017.97
5.5.290.0130.06317.97
5.5.280.0100.07320.67
5.5.270.0130.07720.99
5.5.260.0070.08720.89
5.5.250.0030.07720.52
5.5.240.0030.04020.06
5.4.450.0570.06019.16
5.4.440.0930.06019.45
5.4.430.0970.05319.20
5.4.420.1100.06319.60
5.4.410.0170.06019.42
5.4.400.0200.05718.88
5.4.390.0270.05318.73
5.4.380.0230.05718.61
5.4.370.0230.05718.75
5.4.360.0330.04318.54
5.4.350.0130.06018.61
5.4.340.0230.06018.78
5.4.320.0230.05318.72
5.4.310.0370.03718.54
5.4.300.0100.06718.59
5.4.290.0270.05018.57
5.4.280.0170.05718.77
5.4.270.0300.04318.75
5.4.260.0230.05018.84
5.4.250.0230.05318.73
5.4.240.0330.05018.72
5.4.230.0130.06018.53
5.4.220.0300.04718.50
5.4.210.0170.05718.71
5.4.200.0200.05016.79
5.4.190.0300.05018.49
5.4.180.0170.05718.71
5.4.170.0230.05318.59
5.4.160.0230.04718.56
5.4.150.0270.04718.68
5.4.140.0200.07016.19
5.4.130.0200.06316.30
5.4.120.0170.05316.30
5.4.110.0300.04316.24
5.4.100.0170.05716.45
5.4.90.0300.04316.29
5.4.80.0200.05016.35
5.4.70.0200.05016.24
5.4.60.0230.05316.41
5.4.50.0230.05016.31
5.4.40.0130.06316.25
5.4.30.0370.04716.21
5.4.20.0300.04316.17
5.4.10.0200.05016.30
5.4.00.0230.05015.73
5.3.290.0170.07314.77
5.3.280.0230.07014.61
5.3.270.0230.07714.79
5.3.260.0200.06014.72
5.3.250.0200.05314.67
5.3.240.0300.06014.71
5.3.230.0230.05314.59
5.3.220.0300.04714.69
5.3.210.0270.05014.59
5.3.200.0230.05014.77
5.3.190.0200.05714.86
5.3.180.0230.06714.63
5.3.170.0300.04314.61
5.3.160.0230.06014.61
5.3.150.0170.06314.62
5.3.140.0230.05314.66
5.3.130.0130.07314.85
5.3.120.0270.05314.54
5.3.110.0200.06014.66
5.3.100.0230.07014.14
5.3.90.0170.08014.04
5.3.80.0270.04714.09
5.3.70.0230.04714.05
5.3.60.0200.05014.19
5.3.50.0230.05314.02
5.3.40.0330.04713.96
5.3.30.0170.05713.97
5.3.20.0200.05313.76
5.3.10.0200.05013.80
5.3.00.0400.04013.82
5.2.170.0230.05711.26
5.2.160.0130.04711.26
5.2.150.0270.03311.26
5.2.140.0170.04011.21
5.2.130.0170.03711.24
5.2.120.0100.04311.13
5.2.110.0170.04311.19
5.2.100.0170.03711.19
5.2.90.0070.04711.23
5.2.80.0100.04711.23
5.2.70.0170.04011.32
5.2.60.0200.04011.13
5.2.50.0130.04311.14
5.2.40.0130.04011.02
5.2.30.0170.04310.98
5.2.20.0130.05011.16
5.2.10.0200.04710.92
5.2.00.0170.05310.79
5.1.60.0130.0509.99
5.1.50.0200.04310.14
5.1.40.0170.0339.98
5.1.30.0230.03310.48
5.1.20.0130.05010.42
5.1.10.0130.04310.29
5.1.00.0230.02710.22
5.0.50.0130.0408.65
5.0.40.0130.0238.48
5.0.30.0100.0578.38
5.0.20.0100.0238.40
5.0.10.0100.0238.18
5.0.00.0070.0478.27
4.4.90.0100.0206.04
4.4.80.0100.0175.90
4.4.70.0030.0235.93
4.4.60.0070.0305.90
4.4.50.0070.0235.95
4.4.40.0000.0435.92
4.4.30.0030.0275.94
4.4.20.0070.0305.98
4.4.10.0070.0305.98
4.4.00.0100.0375.93
4.3.110.0130.0205.88
4.3.100.0030.0235.87
4.3.90.0070.0205.86
4.3.80.0000.0405.85
4.3.70.0070.0235.85
4.3.60.0030.0305.84
4.3.50.0100.0275.84
4.3.40.0100.0375.79
4.3.30.0030.0304.61
4.3.20.0030.0334.59
4.3.10.0000.0274.51
4.3.00.0100.0207.32

preferences:
44.37 ms | 401 KiB | 5 Q