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 'TAG "' . $name . '" WAS HERE'; } } class App { function run() { // Prerequisites. $system_tags = new system_tags(); $core = new \stdClass(); $core->tags = array( 'hello' => 'HELLO!', 'world' => 'WORLD!', ); $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>"; } }

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.00616.50
8.3.50.0110.00921.87
8.3.40.0120.00318.77
8.3.30.0120.00319.09
8.3.20.0040.00420.30
8.3.10.0040.00421.60
8.3.00.0030.00619.25
8.2.180.0110.01118.41
8.2.170.0070.00722.96
8.2.160.0100.00320.32
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0080.00019.39
8.2.110.0040.00422.32
8.2.100.0080.00417.50
8.2.90.0000.00818.88
8.2.80.0000.00817.97
8.2.70.0030.00617.50
8.2.60.0040.00417.80
8.2.50.0050.00318.07
8.2.40.0030.00717.89
8.2.30.0060.00317.84
8.2.20.0000.00717.57
8.2.10.0040.00417.83
8.2.00.0040.00417.43
8.1.280.0030.01725.92
8.1.270.0070.00024.66
8.1.260.0050.00326.35
8.1.250.0050.00228.09
8.1.240.0080.00017.71
8.1.230.0030.00918.80
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0040.00417.22
8.1.190.0080.00016.88
8.1.180.0040.00418.10
8.1.170.0000.00920.34
8.1.160.0040.00421.98
8.1.150.0000.00718.76
8.1.140.0040.00417.27
8.1.130.0070.00017.79
8.1.120.0040.00417.38
8.1.110.0040.00417.41
8.1.100.0000.00717.35
8.1.90.0070.00017.37
8.1.80.0040.00417.36
8.1.70.0070.00017.25
8.1.60.0040.00417.48
8.1.50.0000.00817.48
8.1.40.0050.00217.30
8.1.30.0040.00417.46
8.1.20.0000.00817.46
8.1.10.0000.00717.34
8.1.00.0040.00417.27
8.0.300.0040.00418.77
8.0.290.0000.00816.58
8.0.280.0000.00718.26
8.0.270.0030.00317.21
8.0.260.0030.00317.15
8.0.250.0030.00316.76
8.0.240.0030.00316.73
8.0.230.0070.00016.78
8.0.220.0030.00316.81
8.0.210.0040.00416.79
8.0.200.0030.00316.82
8.0.190.0040.00416.80
8.0.180.0000.00716.83
8.0.170.0040.00416.70
8.0.160.0030.00516.70
8.0.150.0050.00316.79
8.0.140.0000.00816.73
8.0.130.0030.00313.27
8.0.120.0000.00716.79
8.0.110.0040.00416.70
8.0.100.0040.00416.77
8.0.90.0050.00216.75
8.0.80.0120.00316.67
8.0.70.0000.00716.68
8.0.60.0050.00316.85
8.0.50.0040.00416.76
8.0.30.0140.00717.00
8.0.20.0160.00217.40
8.0.10.0030.00316.69
8.0.00.0050.01116.56
7.4.330.0030.00315.03
7.4.320.0040.00416.40
7.4.300.0030.00316.50
7.4.290.0030.00316.52
7.4.280.0000.00716.34
7.4.270.0000.00716.50
7.4.260.0000.00716.34
7.4.250.0000.00716.41
7.4.240.0000.00816.45
7.4.230.0000.00716.52
7.4.220.0180.00016.36
7.4.210.0120.00316.54
7.4.200.0000.00716.40
7.4.160.0080.01316.35
7.4.150.0250.02217.40
7.4.140.0110.01117.86
7.4.130.0090.00816.37
7.4.120.0070.01016.32
7.4.110.0160.00716.34
7.4.100.0130.00316.26
7.4.90.0100.00716.27
7.4.80.0000.01719.39
7.4.70.0070.01016.43
7.4.60.0120.00616.49
7.4.50.0020.00216.45
7.4.40.0060.00916.47
7.4.30.0090.00916.45
7.4.00.0070.01014.84
7.3.330.0030.00313.22
7.3.320.0090.00513.07
7.3.310.0060.00016.01
7.3.300.0040.00316.21
7.3.290.0070.00716.20
7.3.280.0110.01016.15
7.3.270.0080.00817.40
7.3.260.0150.00916.46
7.3.250.0120.01116.41
7.3.240.0040.01816.17
7.3.230.0150.00416.39
7.3.210.0120.00616.46
7.3.200.0040.01419.39
7.3.190.0090.00616.46
7.3.180.0060.01616.06
7.3.170.0120.01016.27
7.3.160.0130.00316.23
7.3.10.0040.00816.71
7.3.00.0060.00316.47
7.2.330.0190.00416.17
7.2.320.0060.01616.44
7.2.310.0090.00916.59
7.2.300.0090.01016.41
7.2.290.0190.00316.51
7.2.130.0030.00816.62
7.2.120.0040.01116.74
7.2.110.0000.01016.90
7.2.100.0070.01016.75
7.2.90.0090.00616.69
7.2.80.0090.00616.50
7.2.70.0000.00916.83
7.2.60.0050.00816.67
7.2.50.0070.00716.65
7.2.40.0120.00016.79
7.2.30.0040.01216.91
7.2.20.0040.00816.93
7.2.10.0080.00816.80
7.2.00.0030.01217.93
7.1.250.0040.00415.64
7.1.200.0040.01115.52
7.1.100.0120.00618.02
7.1.70.0000.00716.75
7.1.60.0040.00716.87
7.1.50.0030.01516.98
7.1.00.0030.07722.53
7.0.200.0070.01016.70
7.0.140.0000.07322.10
7.0.60.0130.07319.90
7.0.50.0000.05017.74
7.0.40.0000.04720.29
7.0.30.0270.05020.31
7.0.20.0200.06720.19
7.0.10.0330.07320.19
7.0.00.0130.08020.23
5.6.280.0000.07720.80
5.6.210.0100.05320.63
5.6.200.0200.03718.29
5.6.190.0000.08020.57
5.6.180.0200.06320.53
5.6.170.0300.07320.44
5.6.160.0100.04020.46
5.6.150.0030.08018.17
5.6.140.0170.06018.28
5.6.130.0070.05318.30
5.6.120.0000.06720.98
5.6.110.0070.07021.13
5.6.100.0070.07721.02
5.6.90.0000.07721.03
5.6.80.0070.07720.50
5.5.350.0100.08320.51
5.5.340.0070.04018.08
5.5.330.0000.05020.43
5.5.320.0100.06720.57
5.5.310.0230.08020.38
5.5.300.0070.06317.99
5.5.290.0130.07717.98
5.5.280.0130.07720.78
5.5.270.0030.05320.89
5.5.260.0130.07720.81
5.5.250.0170.07720.48
5.5.240.0170.07720.38
5.4.450.0530.06319.45
5.4.440.0900.06019.62
5.4.430.0970.05019.46
5.4.420.0800.05319.46
5.4.410.0170.04719.35
5.4.400.0270.06718.78
5.4.390.0130.07318.71
5.4.380.0230.05318.72
5.4.370.0270.04718.51
5.4.360.0230.04718.57
5.4.350.0400.06318.86
5.4.340.0230.05718.55
5.4.320.0300.05018.50
5.4.310.0230.06018.58
5.4.300.0130.06718.63
5.4.290.0300.04318.83
5.4.280.0200.08018.77
5.4.270.0100.06318.46
5.4.260.0170.07018.53
5.4.250.0370.04018.73
5.4.240.0300.04718.80
5.4.230.0230.05018.54
5.4.220.0130.06318.57
5.4.210.0170.05718.56
5.4.200.0100.06016.60
5.4.190.0230.05018.60
5.4.180.0330.04318.71
5.4.170.0230.05318.74
5.4.160.0270.04718.69
5.4.150.0300.05018.56
5.4.140.0230.05716.48
5.4.130.0330.05316.33
5.4.120.0270.05016.36
5.4.110.0170.05316.27
5.4.100.0230.05016.45
5.4.90.0230.05016.35
5.4.80.0170.05316.28
5.4.70.0230.05716.44
5.4.60.0130.05716.41
5.4.50.0170.05316.34
5.4.40.0230.04716.43
5.4.30.0330.04316.23
5.4.20.0130.06016.21
5.4.10.0170.05316.27
5.4.00.0230.05015.76
5.3.290.0330.03714.77
5.3.280.0300.04014.70
5.3.270.0230.05314.72
5.3.260.0130.06014.65
5.3.250.0170.05714.60
5.3.240.0230.04714.82
5.3.230.0200.05314.82
5.3.220.0270.05314.79
5.3.210.0130.06014.86
5.3.200.0370.03314.57
5.3.190.0230.05014.64
5.3.180.0100.06314.76
5.3.170.0130.05714.68
5.3.160.0130.05314.63
5.3.150.0230.04714.63
5.3.140.0100.06014.70
5.3.130.0000.07314.76
5.3.120.0130.06014.85
5.3.110.0200.05314.60
5.3.100.0200.05314.10
5.3.90.0170.05714.05
5.3.80.0300.06314.08
5.3.70.0230.07014.12
5.3.60.0300.04014.12
5.3.50.0130.05714.02
5.3.40.0170.05714.13
5.3.30.0300.04714.06
5.3.20.0100.06013.75
5.3.10.0230.05013.67
5.3.00.0270.04713.66
5.2.170.0170.04711.21
5.2.160.0100.05311.14
5.2.150.0170.04311.28
5.2.140.0170.04011.21
5.2.130.0200.04011.23
5.2.120.0230.03311.32
5.2.110.0130.04011.15
5.2.100.0170.03711.14
5.2.90.0170.04011.13
5.2.80.0130.04311.13
5.2.70.0270.03311.11
5.2.60.0100.04711.14
5.2.50.0170.04011.14
5.2.40.0230.04311.06
5.2.30.0100.05311.18
5.2.20.0200.03310.96
5.2.10.0130.04010.90
5.2.00.0100.04710.75
5.1.60.0100.03710.08
5.1.50.0200.02710.05
5.1.40.0130.03310.20
5.1.30.0100.04010.57
5.1.20.0130.03710.50
5.1.10.0130.03310.07
5.1.00.0070.04010.11
5.0.50.0100.0308.71
5.0.40.0100.0278.47
5.0.30.0070.0478.32
5.0.20.0070.0278.40
5.0.10.0100.0238.23
5.0.00.0100.0408.22
4.4.90.0130.0275.92
4.4.80.0070.0335.93
4.4.70.0170.0135.98
4.4.60.0030.0235.89
4.4.50.0030.0275.91
4.4.40.0030.0405.99
4.4.30.0100.0275.94
4.4.20.0070.0336.04
4.4.10.0000.0275.97
4.4.00.0000.0405.93
4.3.110.0030.0235.83
4.3.100.0030.0235.87
4.3.90.0100.0175.85
4.3.80.0070.0335.83
4.3.70.0030.0205.84
4.3.60.0030.0235.80
4.3.50.0170.0135.88
4.3.40.0030.0375.79
4.3.30.0000.0274.62
4.3.20.0070.0204.54
4.3.10.0000.0304.64
4.3.00.0100.0237.32

preferences:
47.01 ms | 401 KiB | 5 Q