3v4l.org

run code in 300+ PHP versions simultaneously
<?php if ( ! defined('PHP_EOL')) { define('PHP_EOL', chr(10)); } $string = 'Hello {{ name }}, nice to meet you.'; define('TAG_OPEN', '{{'); define('TAG_CLOSE', '}}'); define('STATE_TEXT', 'STATE_TEXT'); define('STATE_IN_TAG', 'STATE_IN_TAG'); function isOpenTag($string, $index) { return TAG_OPEN === substr($string, $index, strlen(TAG_OPEN)); } function isCloseTag($string, $index) { return TAG_CLOSE === substr($string, $index, strlen(TAG_CLOSE)); } function isText($string, $index) { return ! (isOpenTag($string, $index) || isCloseTag($string, $index)); } $state = STATE_TEXT; for($index = 0; $index < strlen($string); $index++) { if (isText($string, $index) && $state != STATE_IN_TAG) { continue; } if (isOpenTag($string, $index)) { $state = STATE_IN_TAG; $index += strlen(TAG_OPEN) - 1; continue; } if (isText($string, $index) && $state = STATE_IN_TAG) { echo $index, ' ', $string[$index], PHP_EOL; } if (isCloseTag($string, $index)) { $state = STATE_TEXT; $index += strlen(TAG_CLOSE) - 1; continue; } }

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.0110.00416.88
8.3.50.0120.01021.98
8.3.40.0120.00618.86
8.3.30.0040.01119.22
8.3.20.0030.00520.35
8.3.10.0030.00523.65
8.3.00.0080.00020.90
8.2.180.0120.00316.73
8.2.170.0120.00622.96
8.2.160.0110.00420.32
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0080.00020.95
8.2.110.0080.00420.93
8.2.100.0120.00017.84
8.2.90.0000.00819.17
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0000.01117.92
8.2.50.0000.00818.07
8.2.40.0040.00421.19
8.2.30.0040.00418.37
8.2.20.0000.00817.83
8.2.10.0000.00718.13
8.2.00.0040.00417.83
8.1.280.0060.00925.92
8.1.270.0080.00023.83
8.1.260.0060.00326.35
8.1.250.0100.00328.09
8.1.240.0100.00022.19
8.1.230.0040.00720.84
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0050.00517.36
8.1.190.0040.00417.23
8.1.180.0060.00618.10
8.1.170.0030.00618.70
8.1.160.0000.00722.09
8.1.150.0020.00518.69
8.1.140.0000.00817.46
8.1.130.0000.00817.82
8.1.120.0000.00717.37
8.1.110.0000.01117.46
8.1.100.0050.00317.38
8.1.90.0000.00717.44
8.1.80.0040.00417.53
8.1.70.0000.00817.45
8.1.60.0040.00417.52
8.1.50.0040.00417.49
8.1.40.0050.00517.51
8.1.30.0000.00817.55
8.1.20.0060.00317.58
8.1.10.0000.00817.66
8.1.00.0000.00817.41
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0020.00518.46
8.0.270.0000.00817.30
8.0.260.0030.00317.32
8.0.250.0070.00017.02
8.0.240.0000.00817.05
8.0.230.0030.00317.01
8.0.220.0000.00717.05
8.0.210.0030.00316.96
8.0.200.0030.00316.90
8.0.190.0040.00416.98
8.0.180.0040.00417.00
8.0.170.0030.00516.89
8.0.160.0070.00017.03
8.0.150.0040.00316.98
8.0.140.0030.00416.82
8.0.130.0030.00313.38
8.0.120.0030.00616.89
8.0.110.0000.00716.81
8.0.100.0020.00516.85
8.0.90.0040.00417.04
8.0.80.0060.01016.99
8.0.70.0040.00416.94
8.0.60.0040.00416.98
8.0.50.0040.00417.02
8.0.30.0100.00917.01
8.0.20.0090.01017.43
8.0.10.0000.00817.09
8.0.00.0080.00916.69
7.4.330.0020.00215.00
7.4.320.0030.00316.41
7.4.300.0060.00016.53
7.4.290.0030.00316.41
7.4.280.0000.00816.60
7.4.270.0000.00716.59
7.4.260.0030.00316.59
7.4.250.0040.00416.49
7.4.240.0020.00516.50
7.4.230.0020.00516.66
7.4.220.0100.01016.55
7.4.210.0040.01016.59
7.4.200.0000.00716.71
7.4.190.0030.00316.66
7.4.160.0110.00416.73
7.4.150.0030.01617.40
7.4.140.0110.00917.86
7.4.130.0090.00816.53
7.4.120.0100.01216.64
7.4.110.0120.01216.54
7.4.100.0100.00716.36
7.4.90.0150.00316.51
7.4.80.0160.00319.39
7.4.70.0130.00616.46
7.4.60.0120.00616.66
7.4.50.0030.00316.41
7.4.40.0130.00316.61
7.4.30.0090.01016.73
7.4.00.0000.01515.11
7.3.330.0030.00313.46
7.3.320.0000.00813.43
7.3.310.0040.00416.29
7.3.300.0000.00716.52
7.3.290.0050.01016.41
7.3.280.0080.00816.44
7.3.270.0130.00317.40
7.3.260.0100.00816.29
7.3.250.0100.01016.64
7.3.240.0060.01316.61
7.3.230.0090.00916.39
7.3.210.0130.00316.59
7.3.200.0130.00919.39
7.3.190.0160.00616.29
7.3.180.0080.01116.45
7.3.170.0130.00416.66
7.3.160.0100.00616.38
7.3.120.0070.00715.12
7.2.330.0150.00516.72
7.2.320.0120.01316.77
7.2.310.0070.01716.38
7.2.300.0030.01416.71
7.2.290.0080.01116.72
7.2.80.0200.00715.99
7.2.60.0100.00316.96
7.2.00.0040.00819.34
7.1.200.0070.00715.61
7.1.100.0040.01118.32
7.1.70.0050.00317.19
7.1.60.0100.01419.46
7.1.50.0000.01116.99
7.1.00.0070.07322.34
7.0.200.0100.00514.86
7.0.140.0030.07322.21
7.0.110.0600.07719.93
7.0.100.0500.08719.92
7.0.90.0630.07719.91
7.0.80.0500.08319.93
7.0.70.0530.08019.90
7.0.60.0500.08020.05
7.0.50.0300.06720.15
7.0.40.0030.07720.11
7.0.30.0030.07720.23
7.0.20.0130.03719.99
7.0.10.0070.07720.17
7.0.00.0030.08019.97
5.6.280.0130.06321.00
5.6.250.0070.07020.54
5.6.240.0100.07720.53
5.6.230.0070.05320.59
5.6.220.0130.07720.61
5.6.210.0100.05020.65
5.6.200.0130.06021.02
5.6.190.0100.08021.18
5.6.180.0070.04721.06
5.6.170.0070.08021.12
5.6.160.0030.08020.89
5.6.150.0100.05721.11
5.6.140.0030.08321.23
5.6.130.0130.06721.01
5.6.120.0070.06721.23
5.6.110.0100.04321.22
5.6.100.0130.07721.16
5.6.90.0100.08020.90
5.6.80.0130.06320.54
5.6.70.0170.06720.29
5.6.60.0100.04320.45
5.6.50.0170.07320.54
5.6.40.0100.07720.39
5.6.30.0200.05720.40
5.6.20.0170.06020.28
5.6.10.0100.07020.27
5.6.00.0100.06720.59
5.5.380.0000.06020.48
5.5.370.0130.08020.33
5.5.360.0070.08320.28
5.5.350.0130.07720.42
5.5.340.0070.08020.78
5.5.330.0100.08320.76
5.5.320.0030.05720.96
5.5.310.0200.07020.95
5.5.300.0030.05320.84
5.5.290.0070.05320.71
5.5.280.0100.04320.85
5.5.270.0230.07020.74
5.5.260.0130.07020.80
5.5.250.0100.07720.70
5.5.240.0130.06320.22
5.5.230.0130.07720.09
5.5.220.0230.05020.29
5.5.210.0070.08020.25
5.5.200.0100.08320.13
5.5.190.0070.08020.29
5.5.180.0200.07020.18
5.5.160.0170.05720.09
5.5.150.0030.07720.31
5.5.140.0070.05719.94
5.5.130.0030.08720.30
5.5.120.0070.04020.12
5.5.110.0030.08720.18
5.5.100.0070.08320.18
5.5.90.0100.07320.18
5.5.80.0070.04720.11
5.5.70.0030.04020.06
5.5.60.0070.07319.94
5.5.50.0200.06020.16
5.5.40.0030.07719.97
5.5.30.0070.07320.12
5.5.20.0000.07720.12
5.5.10.0100.07320.07
5.5.00.0070.05019.99
5.4.450.0100.06719.36
5.4.440.0030.08319.55
5.4.430.0100.06719.48
5.4.420.0030.08719.32
5.4.410.0070.04719.14
5.4.400.0100.07719.18
5.4.390.0070.07018.97
5.4.380.0070.07019.18
5.4.370.0070.07019.00
5.4.360.0030.07719.03
5.4.350.0130.05319.00
5.4.340.0100.07319.18
5.4.320.0200.06019.02
5.4.310.0000.08319.02
5.4.300.0030.04019.16
5.4.290.0030.08319.22
5.4.280.0170.06719.30
5.4.270.0070.07319.22
5.4.260.0100.08018.98
5.4.250.0100.08019.30
5.4.240.0100.06319.00
5.4.230.0130.06019.00
5.4.220.0130.04019.00
5.4.210.0100.07019.23
5.4.200.0030.08019.32
5.4.190.0000.07719.32
5.4.180.0170.06319.08
5.4.170.0070.04319.00
5.4.160.0100.06719.29
5.4.150.0000.05018.98
5.4.140.0070.08016.47
5.4.130.0100.07016.55
5.4.120.0130.06016.55
5.4.110.0000.07316.32
5.4.100.0000.07316.61
5.4.90.0100.04716.54
5.4.80.0130.06716.58
5.4.70.0030.07716.40
5.4.60.0070.03716.48
5.4.50.0030.07316.62
5.4.40.0070.06716.34
5.4.30.0100.06716.54
5.4.20.0070.03316.49
5.4.10.0070.07716.33
5.4.00.0030.07715.91
5.3.290.0100.03714.71
5.3.280.0070.07714.84
5.3.270.0000.05314.63
5.3.260.0100.08014.58
5.3.250.0070.03714.48
5.3.240.0070.07714.63
5.3.230.0070.07314.75
5.3.220.0100.07014.62
5.3.210.0100.07314.73
5.3.200.0230.06014.71
5.3.190.0070.06014.44
5.3.180.0030.05014.57
5.3.170.0030.06014.54
5.3.160.0000.07314.57
5.3.150.0000.04314.58
5.3.140.0030.07314.43
5.3.130.0100.07314.52
5.3.120.0130.07314.71
5.3.110.0070.08014.70
5.3.100.0100.02714.13
5.3.90.0000.07314.03
5.3.80.0100.06014.09
5.3.70.0070.07713.99
5.3.60.0100.06313.98
5.3.50.0100.07013.98
5.3.40.0100.06713.96
5.3.30.0070.07013.95
5.3.20.0130.06013.71
5.3.10.0070.06713.76
5.3.00.0030.07013.66
5.2.170.0030.06311.73
5.2.160.0070.06311.73
5.2.150.0030.03711.73
5.2.140.0070.03711.73
5.2.130.0030.03711.73
5.2.120.0070.06011.73
5.2.110.0000.07011.73
5.2.100.0030.04011.73
5.2.90.0070.06011.73
5.2.80.0070.05311.73
5.2.70.0070.06311.73
5.2.60.0030.06011.73
5.2.50.0000.06711.73
5.2.40.0030.06311.73
5.2.30.0030.05711.73
5.2.20.0100.03011.73
5.2.10.0000.06711.73
5.2.00.0070.04711.73
5.1.60.0030.04011.73
5.1.50.0070.05011.73
5.1.40.0070.04311.73
5.1.30.0070.05711.73
5.1.20.0100.04711.73
5.1.10.0070.05311.73
5.1.00.0000.06011.73
5.0.50.0100.04011.73
5.0.40.0070.03711.73
5.0.30.0030.06011.73
5.0.20.0070.04311.73
5.0.10.0000.04711.73
5.0.00.0000.06711.73
4.4.90.0070.03011.73
4.4.80.0070.03011.73
4.4.70.0000.03711.73
4.4.60.0000.04011.73
4.4.50.0030.03311.73
4.4.40.0000.05711.73
4.4.30.0030.03711.73
4.4.20.0000.03711.73
4.4.10.0000.03011.73
4.4.00.0070.05011.73
4.3.110.0000.02711.73
4.3.100.0000.02311.73
4.3.90.0000.03711.73
4.3.80.0000.05311.73
4.3.70.0100.03011.73
4.3.60.0000.04011.73
4.3.50.0030.02011.73
4.3.40.0030.04711.73
4.3.30.0030.03711.73
4.3.20.0000.03711.73
4.3.10.0030.03311.73
4.3.00.0000.03711.73

preferences:
44.71 ms | 401 KiB | 5 Q