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); echo $this->template . "\n"; $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 . '}', $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 ); } } } $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.61
8.3.50.0120.00622.00
8.3.40.0160.00019.05
8.3.30.0110.00319.21
8.3.20.0070.00020.39
8.3.10.0080.00021.73
8.3.00.0050.00319.38
8.2.180.0070.01118.79
8.2.170.0110.01122.96
8.2.160.0110.00420.52
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00919.79
8.2.110.0070.00420.35
8.2.100.0060.00618.03
8.2.90.0050.00318.03
8.2.80.0040.00417.97
8.2.70.0040.00418.04
8.2.60.0000.00917.93
8.2.50.0000.00918.10
8.2.40.0000.00820.43
8.2.30.0000.00718.17
8.2.20.0040.00417.93
8.2.10.0000.00718.05
8.2.00.0080.00017.86
8.1.280.0150.00325.92
8.1.270.0030.00620.46
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0040.00423.92
8.1.230.0040.00719.09
8.1.220.0030.00617.74
8.1.210.0030.00618.77
8.1.200.0000.00917.60
8.1.190.0090.00017.38
8.1.180.0060.00318.10
8.1.170.0030.00618.65
8.1.160.0040.00422.02
8.1.150.0070.00018.94
8.1.140.0000.00717.58
8.1.130.0000.00717.83
8.1.120.0000.00917.69
8.1.110.0040.00417.64
8.1.100.0070.00017.61
8.1.90.0040.00417.65
8.1.80.0040.00417.60
8.1.70.0050.00317.63
8.1.60.0040.00417.74
8.1.50.0000.00917.71
8.1.40.0000.00817.68
8.1.30.0060.00317.89
8.1.20.0040.00417.80
8.1.10.0000.00817.73
8.1.00.0000.00717.69
8.0.300.0110.00019.62
8.0.290.0000.00716.63
8.0.280.0000.00718.55
8.0.270.0030.00317.22
8.0.260.0000.00717.20
8.0.250.0070.00017.02
8.0.240.0000.00717.11
8.0.230.0000.00717.03
8.0.220.0040.00416.99
8.0.210.0000.00716.91
8.0.200.0040.00417.08
8.0.190.0080.00017.12
8.0.180.0040.00417.07
8.0.170.0060.00317.09
8.0.160.0000.00917.11
8.0.150.0030.00517.02
8.0.140.0000.00717.02
8.0.130.0070.00013.57
8.0.120.0050.00317.06
8.0.110.0040.00417.13
8.0.100.0000.00717.04
8.0.90.0000.00817.01
8.0.80.0080.00717.08
8.0.70.0030.00516.93
8.0.60.0030.00617.05
8.0.50.0020.00516.87
8.0.30.0110.01117.33
8.0.20.0110.00917.40
8.0.10.0040.00417.05
8.0.00.0150.00517.01
7.4.330.0000.00515.22
7.4.320.0040.00416.86
7.4.300.0030.00316.74
7.4.290.0070.00016.82
7.4.280.0050.00216.68
7.4.270.0000.00816.69
7.4.260.0000.00816.71
7.4.250.0040.00416.69
7.4.240.0050.00316.76
7.4.230.0040.00416.91
7.4.220.0120.00616.63
7.4.210.0060.00916.72
7.4.200.0000.00716.66
7.4.160.0030.01216.67
7.4.150.0210.02717.40
7.4.140.0090.00917.86
7.4.130.0110.00616.85
7.4.120.0070.01016.65
7.4.110.0120.01516.86
7.4.100.0070.01316.61
7.4.90.0100.01016.85
7.4.80.0130.00419.39
7.4.70.0030.01716.70
7.4.60.0090.00916.81
7.4.50.0000.00416.60
7.4.40.0140.00316.86
7.4.30.0030.01716.64
7.4.00.0100.00714.88
7.3.330.0000.00613.32
7.3.320.0130.00013.45
7.3.310.0070.00016.43
7.3.300.0000.00716.46
7.3.290.0070.00916.44
7.3.280.0070.01116.41
7.3.270.0100.00717.40
7.3.260.0060.01216.67
7.3.250.0130.00416.63
7.3.240.0080.00816.45
7.3.230.0030.01416.65
7.3.210.0090.00916.39
7.3.200.0080.01219.39
7.3.190.0100.00716.43
7.3.180.0100.00616.50
7.3.170.0070.01116.48
7.3.160.0100.00716.57
7.2.330.0030.02316.89
7.2.320.0120.01116.94
7.2.310.0080.01316.83
7.2.300.0150.01116.88
7.2.290.0100.01316.90
7.2.00.0040.01119.68
7.1.200.0110.00316.04
7.1.100.0160.01018.38
7.1.70.0070.00717.55
7.1.60.0030.02019.50
7.1.50.0030.02017.22
7.1.00.0070.07722.47
7.0.200.0070.00715.14
7.0.140.0030.07321.99
7.0.60.0030.04020.04
7.0.50.0070.03717.95
7.0.40.0230.07020.12
7.0.30.0270.07320.21
7.0.20.0170.05020.21
7.0.10.0370.07320.34
7.0.00.0130.03720.11
5.6.280.0070.06720.80
5.6.210.0070.06720.57
5.6.200.0130.08018.19
5.6.190.0030.05020.77
5.6.180.0270.04720.65
5.6.170.0330.08020.47
5.6.160.0000.04320.47
5.6.150.0000.05018.13
5.6.140.0130.08018.27
5.6.130.0070.08318.28
5.6.120.0130.07721.02
5.6.110.0200.04721.00
5.6.100.0070.05020.99
5.6.90.0070.06321.00
5.6.80.0070.07720.44
5.6.70.0370.06020.38
5.5.350.0100.06320.42
5.5.340.0030.06318.09
5.5.330.0070.08320.29
5.5.320.0170.07720.35
5.5.310.0370.07720.29
5.5.300.0030.05017.95
5.5.290.0030.06317.96
5.5.280.0070.07020.82
5.5.270.0170.06320.81
5.5.260.0100.08320.77
5.5.250.0130.08020.70
5.5.240.0070.03720.28
5.4.450.0770.06319.37
5.4.440.0930.06319.20
5.4.430.0970.05319.59
5.4.420.0930.06319.61
5.4.410.1170.05719.06
5.4.400.0230.04718.89
5.4.390.0230.04718.79
5.4.380.0100.06318.54
5.4.370.0230.04718.82
5.4.360.0230.04718.71
5.4.350.0170.05718.58
5.4.340.0130.06318.75
5.4.320.0170.05718.71
5.4.310.0170.08018.48
5.4.300.0200.05318.73
5.4.290.0270.05018.58
5.4.280.0230.05718.53
5.4.270.0330.06718.53
5.4.260.0200.07318.50
5.4.250.0170.06018.78
5.4.240.0230.07318.77
5.4.230.0300.06318.82
5.4.220.0200.06718.81
5.4.210.0170.05318.57
5.4.200.0200.05016.61
5.4.190.0170.05318.52
5.4.180.0270.04718.59
5.4.170.0270.06318.82
5.4.160.0230.05018.71
5.4.150.0370.06718.71
5.4.140.0200.07316.25
5.4.130.0170.05016.31
5.4.120.0170.05316.37
5.4.110.0130.05016.24
5.4.100.0370.03716.45
5.4.90.0230.05016.37
5.4.80.0170.06016.29
5.4.70.0100.06016.18
5.4.60.0100.06016.20
5.4.50.0170.04716.27
5.4.40.0300.06716.32
5.4.30.0200.04716.31
5.4.20.0130.05716.16
5.4.10.0170.05016.14
5.4.00.0170.05015.74
5.3.290.0200.05014.73
5.3.280.0200.05314.70
5.3.270.0100.06314.66
5.3.260.0230.05014.62
5.3.250.0300.04314.74
5.3.240.0200.05714.67
5.3.230.0170.05714.82
5.3.220.0330.04014.86
5.3.210.0200.05314.59
5.3.200.0100.06314.64
5.3.190.0170.05314.72
5.3.180.0200.07014.57
5.3.170.0230.05714.57
5.3.160.0300.06014.78
5.3.150.0130.05314.59
5.3.140.0230.04314.67
5.3.130.0170.05314.72
5.3.120.0270.04314.79
5.3.110.0100.06014.66
5.3.100.0130.05314.15
5.3.90.0100.05714.11
5.3.80.0130.05314.17
5.3.70.0130.05314.14
5.3.60.0200.05014.24
5.3.50.0270.04013.98
5.3.40.0130.05714.00
5.3.30.0170.05013.93
5.3.20.0130.05713.83
5.3.10.0200.04713.77
5.3.00.0200.04713.71
5.2.170.0070.05011.14
5.2.160.0100.04311.18
5.2.150.0030.05311.19
5.2.140.0170.04311.30
5.2.130.0130.04011.22
5.2.120.0100.04711.18
5.2.110.0200.03711.19
5.2.100.0200.04011.14
5.2.90.0100.04711.19
5.2.80.0170.05011.33
5.2.70.0170.04011.19
5.2.60.0230.03311.17
5.2.50.0130.04711.06
5.2.40.0230.03311.04
5.2.30.0200.03711.00
5.2.20.0100.04310.96
5.2.10.0070.05010.93
5.2.00.0100.05310.94
5.1.60.0130.03310.08
5.1.50.0100.03710.03
5.1.40.0070.04010.02
5.1.30.0130.03710.43
5.1.20.0130.05010.49
5.1.10.0100.04010.11
5.1.00.0170.03310.07
5.0.50.0130.0278.59
5.0.40.0130.0278.52
5.0.30.0130.0408.43
5.0.20.0070.0278.30
5.0.10.0070.0308.28
5.0.00.0100.0438.21
4.4.90.0100.0175.97
4.4.80.0000.0335.90
4.4.70.0070.0235.89
4.4.60.0070.0235.93
4.4.50.0030.0235.93
4.4.40.0170.0375.90
4.4.30.0030.0335.93
4.4.20.0030.0336.04
4.4.10.0070.0306.09
4.4.00.0030.0375.94
4.3.110.0030.0235.85
4.3.100.0000.0275.84
4.3.90.0100.0175.82
4.3.80.0000.0405.84
4.3.70.0170.0175.82
4.3.60.0070.0235.94
4.3.50.0100.0175.84
4.3.40.0070.0435.77
4.3.30.0030.0234.59
4.3.20.0030.0234.55
4.3.10.0100.0174.61
4.3.00.0130.0207.32

preferences:
43.83 ms | 401 KiB | 5 Q