3v4l.org

run code in 300+ PHP versions simultaneously
<?php class system_tags { function __call($name, $params) { return 'TAG ' . $name; } } class App { function run() { // Prerequisites. $system_tags = new system_tags(); $code = new \stdClass(); $code->tags = array( 'hello' => 'HELLO', 'world' => 'WORLD', ); $this->template = 'Blah blah {hello} blah blah {world}.'; $this->withStrReplace($code, $system_tags); $this->template = 'Blah blah {hello} blah blah {world}.'; $this->withRegexReplaceCallback($code, $system_tags); } function withStrReplace($code, $system_tags) { foreach($core->tags as $tag_name => $tag_method) { $this->template = str_replace( '{' . $tag_name . '}', $system_tags->{$tag_method}(), $this->template ); } } function withRegexReplaceCallback($code, $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.63
8.3.50.0080.01122.06
8.3.40.0090.00618.32
8.3.30.0070.01118.91
8.3.20.0050.00320.33
8.3.10.0000.00821.54
8.3.00.0040.00419.13
8.2.180.0110.00818.16
8.2.170.0120.00922.96
8.2.160.0140.00319.25
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00019.23
8.2.110.0100.00019.33
8.2.100.0110.00017.50
8.2.90.0030.00519.09
8.2.80.0040.00417.97
8.2.70.0040.00417.25
8.2.60.0050.00317.87
8.2.50.0000.00818.07
8.2.40.0120.00017.81
8.2.30.0040.00418.01
8.2.20.0040.00417.63
8.2.10.0050.00317.82
8.2.00.0000.00817.54
8.1.280.0090.00925.92
8.1.270.0080.00024.66
8.1.260.0050.00226.35
8.1.250.0080.00028.09
8.1.240.0060.00323.78
8.1.230.0080.00318.83
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00317.23
8.1.190.0040.00417.11
8.1.180.0030.00518.10
8.1.170.0040.00420.28
8.1.160.0000.00721.96
8.1.150.0000.00718.81
8.1.140.0050.00317.38
8.1.130.0070.00017.65
8.1.120.0050.00317.39
8.1.110.0000.00817.42
8.1.100.0000.00817.37
8.1.90.0040.00417.39
8.1.80.0050.00317.24
8.1.70.0000.00717.35
8.1.60.0060.00317.47
8.1.50.0030.00617.45
8.1.40.0000.00717.36
8.1.30.0000.00817.54
8.1.20.0000.00817.57
8.1.10.0000.00817.31
8.1.00.0030.00617.30
8.0.300.0070.00018.77
8.0.290.0030.00516.58
8.0.280.0040.00418.37
8.0.270.0030.00317.14
8.0.260.0000.00717.15
8.0.250.0000.00716.88
8.0.240.0000.00716.71
8.0.230.0030.00316.75
8.0.220.0030.00316.66
8.0.210.0030.00316.64
8.0.200.0060.00016.73
8.0.190.0040.00316.82
8.0.180.0000.00716.82
8.0.170.0050.00316.70
8.0.160.0050.00316.88
8.0.150.0040.00416.59
8.0.140.0000.00716.79
8.0.130.0060.00013.14
8.0.120.0000.00816.69
8.0.110.0000.00716.73
8.0.100.0040.00416.77
8.0.90.0000.00816.86
8.0.80.0030.01216.84
8.0.70.0040.00416.63
8.0.60.0080.00016.78
8.0.50.0040.00416.71
8.0.30.0110.01216.89
8.0.20.0000.01917.40
8.0.10.0040.00416.80
8.0.00.0120.00616.57
7.4.330.0050.00015.03
7.4.320.0070.00016.49
7.4.300.0000.00616.48
7.4.290.0070.00016.31
7.4.280.0050.00316.39
7.4.270.0070.00016.35
7.4.260.0000.00716.46
7.4.250.0070.00016.49
7.4.240.0000.00816.49
7.4.230.0030.00316.14
7.4.220.0070.01016.45
7.4.210.0060.00916.59
7.4.200.0070.00016.60
7.4.160.0130.01016.63
7.4.150.0060.01117.40
7.4.140.0100.01017.86
7.4.130.0130.00416.41
7.4.120.0100.00916.50
7.4.110.0130.00716.22
7.4.100.0060.01016.12
7.4.90.0100.00716.37
7.4.80.0070.01019.39
7.4.70.0030.01316.45
7.4.60.0140.00716.48
7.4.50.0000.00516.47
7.4.40.0100.00716.32
7.4.30.0120.00616.50
7.4.00.0030.01414.36
7.3.330.0000.00613.18
7.3.320.0120.00413.13
7.3.310.0040.00216.21
7.3.300.0030.00316.07
7.3.290.0050.00916.19
7.3.280.0070.00916.18
7.3.270.0110.00617.40
7.3.260.0090.00916.17
7.3.250.0110.00616.40
7.3.240.0090.00816.27
7.3.230.0060.01216.39
7.3.210.0090.00916.14
7.3.200.0090.00919.39
7.3.190.0080.00816.18
7.3.180.0090.00616.28
7.3.170.0110.00716.27
7.3.160.0070.01616.48
7.3.120.0070.01014.65
7.3.110.0060.01014.77
7.3.100.0060.00814.42
7.3.90.0000.01114.76
7.3.80.0070.00314.66
7.3.70.0100.00314.70
7.3.60.0030.01014.67
7.3.50.0070.00614.77
7.3.40.0040.01114.53
7.3.30.0070.01014.76
7.3.20.0000.01516.27
7.3.10.0130.00316.49
7.3.00.0080.00816.53
7.2.330.0080.01516.41
7.2.320.0040.01716.59
7.2.310.0000.01816.36
7.2.300.0040.01216.50
7.2.290.0070.01116.28
7.2.240.0030.00915.07
7.2.230.0060.00614.80
7.2.220.0000.01214.68
7.2.210.0040.01514.97
7.2.200.0130.00314.80
7.2.190.0090.00614.65
7.2.180.0070.00714.93
7.2.170.0120.00014.90
7.2.160.0070.00414.96
7.2.150.0070.00716.84
7.2.140.0130.00016.73
7.2.130.0030.00916.71
7.2.120.0030.01416.59
7.2.110.0040.01516.85
7.2.100.0070.00716.58
7.2.90.0070.00716.85
7.2.80.0040.01416.89
7.2.70.0040.01116.74
7.2.60.0040.00916.58
7.2.50.0070.01016.58
7.2.40.0090.00616.66
7.2.30.0060.00616.63
7.2.20.0130.00316.62
7.2.10.0090.00916.89
7.2.00.0100.00517.88
7.1.330.0040.01115.45
7.1.320.0060.00615.31
7.1.310.0140.00015.45
7.1.300.0070.00715.57
7.1.290.0040.01115.72
7.1.280.0070.00715.51
7.1.270.0030.01315.66
7.1.260.0040.01115.43
7.1.250.0070.00715.64
7.1.200.0050.00215.39
7.1.100.0110.00717.98
7.1.70.0080.00016.80
7.1.60.0060.01219.50
7.1.50.0100.01016.86
7.1.00.0030.07722.36
7.0.200.0040.00714.75
7.0.140.0000.07022.00
7.0.60.0030.04019.89
7.0.50.0000.04717.89
7.0.40.0070.08720.02
7.0.30.0400.05320.21
7.0.20.0400.07020.09
7.0.10.0400.06720.27
7.0.00.0070.07720.33
5.6.280.0030.07321.19
5.6.210.0100.07720.63
5.6.200.0130.06318.25
5.6.190.0100.08020.41
5.6.180.0270.08020.36
5.6.170.0330.07320.48
5.6.160.0070.03720.44
5.6.150.0070.04018.14
5.6.140.0030.04318.21
5.6.130.0100.04018.26
5.6.120.0130.05021.02
5.6.110.0200.08320.91
5.6.100.0130.07021.01
5.6.90.0000.07020.99
5.6.80.0070.06320.42
5.6.70.0130.07320.40
5.5.350.0170.04320.40
5.5.340.0000.05017.98
5.5.330.0130.07720.27
5.5.320.0230.03320.43
5.5.310.0300.08020.34
5.5.300.0070.08017.98
5.5.290.0100.07018.08
5.5.280.0130.04720.89
5.5.270.0100.03720.88
5.5.260.0100.05720.66
5.5.250.0170.07020.63
5.5.240.0070.03720.39
5.4.450.0700.05019.61
5.4.440.1070.06319.38
5.4.430.0800.05319.30
5.4.420.0730.06019.55
5.4.410.0800.05719.09
5.4.400.0300.06318.83
5.4.390.0300.05318.83
5.4.380.0270.05018.49
5.4.370.0330.04318.79
5.4.360.0270.05318.58
5.4.350.0230.05318.50
5.4.340.0170.05718.73
5.4.320.0330.04318.73
5.4.310.0170.05718.50
5.4.300.0200.05318.74
5.4.290.0200.05318.73
5.4.280.0100.06018.75
5.4.270.0230.05718.78
5.4.260.0230.06018.51
5.4.250.0130.06318.75
5.4.240.0300.05318.58
5.4.230.0130.06018.54
5.4.220.0270.05318.57
5.4.210.0230.05018.79
5.4.200.0200.05016.57
5.4.190.0270.05718.69
5.4.180.0130.06018.47
5.4.170.0270.05018.56
5.4.160.0200.05318.76
5.4.150.0300.06318.50
5.4.140.0230.06716.33
5.4.130.0100.05716.49
5.4.120.0170.07316.47
5.4.110.0170.05016.34
5.4.100.0200.05016.46
5.4.90.0230.04316.28
5.4.80.0270.04016.40
5.4.70.0170.05716.20
5.4.60.0200.04716.18
5.4.50.0200.05016.40
5.4.40.0100.05716.41
5.4.30.0230.04716.26
5.4.20.0270.04716.23
5.4.10.0230.04716.18
5.4.00.0200.04715.75
5.3.290.0330.06314.71
5.3.280.0270.05014.80
5.3.270.0300.04714.68
5.3.260.0200.05714.73
5.3.250.0200.05714.79
5.3.240.0130.06014.67
5.3.230.0230.06714.78
5.3.220.0170.05714.78
5.3.210.0270.06714.56
5.3.200.0270.07014.57
5.3.190.0200.05714.71
5.3.180.0170.05314.56
5.3.170.0170.05314.68
5.3.160.0170.05714.63
5.3.150.0230.04714.70
5.3.140.0170.05314.62
5.3.130.0270.05714.66
5.3.120.0270.07314.76
5.3.110.0270.07014.65
5.3.100.0230.05014.26
5.3.90.0130.05714.03
5.3.80.0200.05014.24
5.3.70.0030.06714.16
5.3.60.0170.05014.00
5.3.50.0330.06014.25
5.3.40.0270.06713.96
5.3.30.0200.05713.90
5.3.20.0270.04713.75
5.3.10.0170.05013.76
5.3.00.0230.05313.74
5.2.170.0130.05011.19
5.2.160.0130.04711.18
5.2.150.0200.03711.16
5.2.140.0170.04011.25
5.2.130.0170.04711.12
5.2.120.0170.03711.34
5.2.110.0270.03011.15
5.2.100.0100.04711.32
5.2.90.0200.05011.24
5.2.80.0270.03311.23
5.2.70.0200.03711.14
5.2.60.0100.04711.08
5.2.50.0230.05311.05
5.2.40.0200.05311.03
5.2.30.0200.04011.02
5.2.20.0100.04311.02
5.2.10.0130.04010.94
5.2.00.0170.05310.97
5.1.60.0130.03710.03
5.1.50.0130.03310.05
5.1.40.0170.03010.00
5.1.30.0170.03010.40
5.1.20.0130.04010.41
5.1.10.0100.03710.07
5.1.00.0130.03310.07
5.0.50.0130.0238.64
5.0.40.0100.0408.47
5.0.30.0070.0608.33
5.0.20.0170.0308.25
5.0.10.0070.0308.32
5.0.00.0000.0508.32
4.4.90.0070.0235.96
4.4.80.0100.0205.93
4.4.70.0030.0235.95
4.4.60.0130.0175.90
4.4.50.0070.0235.94
4.4.40.0030.0505.98
4.4.30.0070.0235.97
4.4.20.0000.0305.99
4.4.10.0100.0275.99
4.4.00.0070.0335.93
4.3.110.0070.0335.98
4.3.100.0030.0275.87
4.3.90.0030.0275.83
4.3.80.0070.0375.89
4.3.70.0070.0305.82
4.3.60.0070.0205.89
4.3.50.0070.0235.81
4.3.40.0130.0275.81
4.3.30.0030.0234.58
4.3.20.0070.0204.58
4.3.10.0070.0274.54
4.3.00.0100.0237.32

preferences:
44.61 ms | 401 KiB | 5 Q