3v4l.org

run code in 500+ PHP versions simultaneously
<?php $text = '[HEAD] [TITLE-MAIN] example news1 [TITLE-SUB] title sub1 [CONTENT] content text1 [HEAD] [TITLE-MAIN] example news2 [TITLE-SUB] title sub2 [CONTENT] content text2'; $sections = array(); foreach (preg_split('/\s*\[HEAD\]\s*/', $text, -1, PREG_SPLIT_NO_EMPTY) as $section) { $s = trim($section); $tag_data = preg_split('/\[([^\]]+)\]/', $s, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); for ($i = 0; $i < count($tag_data); $i += 2) { $tags[$tag_data[$i]] = trim($tag_data[$i+1]); } $sections[] = $tags; } print_r($sections);

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.5.70.0120.00816.84
8.5.60.0120.00716.93
8.5.50.0110.00618.61
8.5.30.0110.00621.46
8.5.20.0070.01119.56
8.5.10.0070.01017.03
8.5.00.0130.00820.16
8.4.220.0120.00919.92
8.4.210.0090.00819.78
8.4.180.0120.00919.85
8.4.170.0120.01021.95
8.4.160.0130.01123.85
8.4.150.0080.00617.00
8.4.140.0180.00817.96
8.4.130.0120.00917.73
8.4.120.0090.00220.33
8.4.110.0040.00522.75
8.4.100.0130.00718.72
8.4.90.0130.00820.28
8.4.80.0050.00418.85
8.4.70.0060.00318.79
8.4.60.0030.01318.98
8.4.50.0100.01020.52
8.4.40.0060.00319.78
8.4.30.0100.01019.53
8.4.20.0060.00320.30
8.4.10.0030.00617.74
8.3.310.0160.00518.70
8.3.300.0110.00918.58
8.3.290.0120.00820.85
8.3.280.0110.01018.50
8.3.270.0140.00516.60
8.3.260.0110.00916.88
8.3.250.0140.00418.94
8.3.240.0040.00516.89
8.3.230.0140.00616.58
8.3.220.0130.00518.91
8.3.210.0130.00716.79
8.3.200.0060.00316.97
8.3.190.0090.00917.16
8.3.180.0100.00816.68
8.3.170.0070.01117.43
8.3.160.0120.00616.66
8.3.150.0130.00621.00
8.3.140.0120.00316.96
8.3.130.0100.01018.64
8.3.120.0100.00719.04
8.3.110.0040.00420.94
8.3.100.0040.00424.06
8.3.90.0080.00026.77
8.3.80.0080.00817.97
8.3.70.0090.00616.88
8.3.60.0060.00918.64
8.3.50.0180.00617.39
8.3.40.0120.00319.00
8.3.30.0100.00618.92
8.3.20.0030.00519.03
8.3.10.0060.00323.64
8.3.00.0040.00422.46
8.2.310.0080.01118.30
8.2.300.0140.00818.19
8.2.290.0140.00619.11
8.2.280.0070.00418.67
8.2.270.0040.00417.31
8.2.260.0030.00618.98
8.2.250.0000.00816.87
8.2.240.0040.00817.34
8.2.230.0040.00422.58
8.2.220.0090.00937.54
8.2.210.0040.00426.77
8.2.200.0030.00616.63
8.2.190.0160.00016.92
8.2.180.0120.00617.00
8.2.170.0110.01122.96
8.2.160.0090.00620.53
8.2.150.0060.00324.18
8.2.140.0070.00024.66
8.2.130.0040.00420.07
8.2.120.0080.00026.35
8.2.110.0030.00720.47
8.2.100.0090.00318.03
8.2.90.0030.00517.97
8.2.80.0080.00017.97
8.2.70.0000.00818.05
8.2.60.0040.00418.22
8.2.50.0040.00418.10
8.2.40.0040.00419.51
8.2.30.0040.00419.41
8.2.20.0040.00418.22
8.2.10.0040.00419.43
8.2.00.0000.00817.98
8.1.340.0110.01119.76
8.1.330.0100.00818.48
8.1.320.0100.01016.62
8.1.310.0070.00020.00
8.1.300.0040.00420.34
8.1.290.0060.00330.84
8.1.280.0100.00725.92
8.1.270.0050.00323.84
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0080.00422.13
8.1.230.0080.00422.47
8.1.220.0060.00317.77
8.1.210.0100.00018.95
8.1.200.0060.00317.48
8.1.190.0000.00817.48
8.1.180.0040.00418.10
8.1.170.0040.00418.66
8.1.160.0040.00418.81
8.1.150.0000.00818.92
8.1.140.0070.00023.95
8.1.130.0000.00717.51
8.1.120.0030.00617.65
8.1.110.0070.00017.64
8.1.100.0060.00317.66
8.1.90.0000.00817.66
8.1.80.0040.00417.61
8.1.70.0030.00317.67
8.1.60.0030.00617.77
8.1.50.0040.00417.57
8.1.40.0040.00417.71
8.1.30.0000.00817.86
8.1.20.0040.00417.82
8.1.10.0070.00017.66
8.1.00.0040.00417.62
8.0.300.0000.00720.02
8.0.290.0040.00417.00
8.0.280.0070.00018.45
8.0.270.0050.00216.85
8.0.260.0030.00316.98
8.0.250.0030.00317.14
8.0.240.0030.00517.19
8.0.230.0000.00717.05
8.0.220.0000.00717.04
8.0.210.0020.00517.06
8.0.200.0000.00817.11
8.0.190.0000.00717.13
8.0.180.0050.00216.98
8.0.170.0000.00917.04
8.0.160.0000.00716.90
8.0.150.0040.00416.98
8.0.140.0020.00517.10
8.0.130.0060.00313.54
8.0.120.0000.00716.89
8.0.110.0040.00417.05
8.0.100.0060.00316.86
8.0.90.0000.00716.91
8.0.80.0070.01217.05
8.0.70.0050.00317.09
8.0.60.0050.00317.08
8.0.50.0080.00016.94
8.0.30.0130.00617.16
8.0.20.0090.01117.40
8.0.10.0040.00417.05
8.0.00.0070.01516.98
7.4.330.0050.00015.55
7.4.320.0030.00316.75
7.4.300.0030.00316.73
7.4.290.0050.00516.87
7.4.280.0000.00916.64
7.4.270.0000.00716.75
7.4.260.0060.00316.82
7.4.250.0000.00816.72
7.4.240.0050.00316.88
7.4.230.0080.00016.67
7.4.220.0040.00416.72
7.4.210.0120.00616.90
7.4.200.0030.00616.93
7.4.160.0110.00616.75
7.4.140.0120.00717.86
7.4.130.0070.01016.63
7.4.120.0090.01016.70
7.4.110.0130.00616.87
7.4.100.0060.01016.82
7.4.90.0140.00416.76
7.4.80.0090.00919.39
7.4.70.0000.01716.71
7.4.60.0130.00316.61
7.4.50.0070.01116.60
7.4.40.0100.00616.70
7.4.00.0040.01115.39
7.3.330.0050.00013.23
7.3.320.0000.00513.34
7.3.310.0000.00716.54
7.3.300.0000.00716.55
7.3.290.0000.00616.39
7.3.280.0160.00316.59
7.3.260.0100.00916.56
7.3.240.0130.00816.64
7.3.230.0140.00316.77
7.3.210.0040.01416.61
7.3.200.0110.00816.55
7.3.190.0140.00716.72
7.3.180.0120.00916.56
7.3.170.0000.01616.76
7.3.160.0040.01316.45
7.2.330.0130.01016.96
7.2.320.0090.00916.67
7.2.310.0090.00916.79
7.2.300.0060.01116.78
7.2.290.0000.02416.92
7.2.110.3740.00814.77
7.2.100.4710.01014.86
7.2.90.3730.00814.87
7.2.80.4820.00714.72
7.2.70.4330.01015.19
7.2.60.4290.00815.25
7.2.50.3900.00715.05
7.2.40.4340.00814.81
7.2.30.2370.00715.01
7.2.20.3810.01315.02
7.2.10.2120.00715.02
7.2.00.3160.00515.06
7.1.230.3200.00613.97
7.1.220.5760.00714.06
7.1.210.5140.01213.97
7.1.200.3750.00714.01
7.1.190.4380.00613.93
7.1.180.4730.01113.98
7.1.170.3920.00713.98
7.1.160.3790.00813.67
7.1.150.1730.00813.85
7.1.140.1920.00713.96
7.1.130.2270.00713.92
7.1.120.2340.00613.91
7.1.110.2400.00814.11
7.1.100.2160.00814.03
7.1.90.2110.01313.91
7.1.80.1740.00013.79
7.1.70.2000.00914.12
7.1.60.1340.00832.13
7.1.50.0640.01332.11
7.1.40.3540.01131.83
7.1.30.3790.01131.91
7.1.20.2290.01332.11
7.1.10.4400.00514.05
7.1.00.1430.00713.97
5.6.380.0130.00814.29

preferences:
1416.37 ms | 1549 KiB | 5 Q