3v4l.org

run code in 300+ PHP versions simultaneously
<?php $commentsString = "His phone is not functional because the camera does not appear/work and he needs it to be usable for Cerity. It also freezes up. He's had his last phone for 3 years, it's time for an upgrade. Thank you!"; $comments = array(); $labels = array( 'Comment Type:' => 'type', 'Comment Body:' => 'body', 'Comment By:' => 'by', 'Comment Date:' => 'date' ); $commentParts = explode('Comment Type:', $commentsString); foreach ($commentParts as $commentPart) { $comment = array(); $commentLines = explode("\n", $commentPart); array_walk($commentLines, create_function('&$val', '$val = trim($val);')); $currentLabel = 'unknown'; foreach ($commentLines as $line) { if (empty($line)) continue; if (empty($comment['type'])) { $comment['type'] = $line; continue; } if (substr($line, 0, 5) == 'Body:') { $line = substr($line, 5); $currentLabel = 'body'; } if (in_array($line, array_keys($labels))) { $currentLabel = $labels[$line]; $comment[$currentLabel] = ''; } else { if (empty($comment[$currentLabel])) $comment[$currentLabel] = ''; $comment[$currentLabel] .= $line . ' '; } } if (!empty($comment)) $comments[] = $comment; } var_dump($comments);

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.0070.00718.43
8.3.50.0180.00322.04
8.3.40.0150.00018.97
8.3.30.0070.00719.19
8.3.20.0060.00320.30
8.3.10.0030.00620.46
8.3.00.0040.00419.67
8.2.180.0040.01417.00
8.2.170.0040.01122.96
8.2.160.0130.00020.53
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0070.00022.18
8.2.110.0100.00022.11
8.2.100.0060.00619.45
8.2.90.0060.00319.13
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0000.00917.80
8.2.50.0040.00418.07
8.2.40.0030.00618.28
8.2.30.0070.00019.28
8.2.20.0040.00417.70
8.2.10.0060.00318.10
8.2.00.0080.00017.72
8.1.280.0030.01725.92
8.1.270.0050.00321.95
8.1.260.0050.00226.35
8.1.250.0080.00028.09
8.1.240.0060.00323.83
8.1.230.0100.00019.09
8.1.220.0040.00417.91
8.1.210.0040.00418.77
8.1.200.0030.00717.25
8.1.190.0080.00017.23
8.1.180.0000.00818.10
8.1.170.0050.00318.55
8.1.160.0040.00422.09
8.1.150.0040.00418.98
8.1.140.0000.00817.55
8.1.130.0030.00317.87
8.1.120.0070.00017.39
8.1.110.0050.00317.38
8.1.100.0040.00417.50
8.1.90.0040.00417.54
8.1.80.0000.00717.56
8.1.70.0000.00717.37
8.1.60.0000.00817.59
8.1.50.0080.00017.56
8.1.40.0040.00417.46
8.1.30.0030.00617.56
8.1.20.0000.00717.69
8.1.10.0030.00517.63
8.1.00.0040.00917.62
8.0.300.0040.00418.77
8.0.290.0050.00216.63
8.0.280.0070.00018.44
8.0.270.0030.00317.17
8.0.260.0000.00717.22
8.0.250.0040.00216.99
8.0.240.0030.00316.93
8.0.230.0070.00017.07
8.0.220.0000.00716.96
8.0.210.0000.00716.90
8.0.200.0040.00417.07
8.0.190.0020.00516.93
8.0.180.0040.00416.99
8.0.170.0000.00717.05
8.0.160.0040.00317.00
8.0.150.0000.00716.96
8.0.140.0030.00316.91
8.0.130.0030.00313.42
8.0.120.0050.00316.96
8.0.110.0000.00717.03
8.0.100.0050.00317.05
8.0.90.0080.00017.03
8.0.80.0090.01216.99
8.0.70.0000.00816.94
8.0.60.0070.00016.89
8.0.50.0040.00417.11
8.0.30.0150.01017.15
8.0.20.0090.01017.44
8.0.10.0020.00517.06
8.0.00.0100.00916.71
7.4.330.0000.00515.13
7.4.320.0060.00016.54
7.4.300.0060.00016.55
7.4.290.0030.00516.54
7.4.280.0090.00016.57
7.4.270.0000.00716.63
7.4.260.0070.00016.42
7.4.250.0000.00716.43
7.4.240.0050.00216.52
7.4.230.0030.00316.75
7.4.220.0140.00316.60
7.4.210.0180.00316.80
7.4.200.0040.00416.46
7.4.160.0090.01216.39
7.4.150.0030.01517.40
7.4.140.0090.00817.86
7.4.130.0120.00516.67
7.4.120.0070.01316.63
7.4.110.0060.00916.66
7.4.100.0070.01316.76
7.4.90.0090.00916.72
7.4.80.0120.00816.50
7.4.70.0110.00516.77
7.4.60.0040.01416.53
7.4.50.0000.00516.58
7.4.40.0100.00716.41
7.4.30.0070.00716.59
7.4.00.0050.01115.22
7.3.330.0050.00013.31
7.3.320.0030.00313.32
7.3.310.0030.00516.30
7.3.300.0030.00316.49
7.3.290.0060.00916.45
7.3.280.0090.00616.43
7.3.270.0110.00717.40
7.3.260.0140.00316.57
7.3.250.0120.00716.57
7.3.240.0130.00316.53
7.3.230.0070.01616.52
7.3.210.0110.00616.47
7.3.200.0120.00619.39
7.3.190.0110.00716.53
7.3.180.0060.01016.31
7.3.170.0070.01816.46
7.3.160.0070.01016.57
7.3.120.0160.00014.83
7.3.110.0040.01414.99
7.3.100.0030.01314.84
7.3.90.0070.00714.90
7.3.80.0070.01014.99
7.3.70.0080.00615.01
7.3.60.0030.01214.90
7.3.50.0060.01014.56
7.3.40.0060.00615.05
7.3.30.0060.00614.94
7.3.20.0090.00316.71
7.3.10.0110.00116.58
7.3.00.0050.00616.43
7.2.330.0140.00516.58
7.2.320.0090.00916.57
7.2.310.0110.00616.60
7.2.300.0040.01516.54
7.2.290.0070.01116.48
7.2.250.0110.00715.00
7.2.240.0100.01014.99
7.2.230.0100.00614.96
7.2.220.0060.00915.25
7.2.210.0000.01115.12
7.2.200.0090.00615.04
7.2.190.0070.01015.03
7.2.180.0040.01114.96
7.2.170.0030.00714.82
7.2.130.0060.00616.73
7.2.120.0090.00316.95
7.2.110.0060.00616.74
7.2.100.0060.00616.77
7.2.90.0060.00617.03
7.2.80.0040.01116.50
7.2.70.0030.01016.61
7.2.60.0050.00816.68
7.2.50.0050.00516.71
7.2.40.0040.01216.76
7.2.30.0030.00916.67
7.2.20.0070.00416.77
7.2.10.0040.00816.85
7.2.00.0090.00418.05
7.1.330.0070.00715.75
7.1.320.0060.00615.85
7.1.310.0070.00715.96
7.1.300.0060.00915.94
7.1.290.0060.00615.86
7.1.280.0060.00316.00
7.1.270.0040.01115.58
7.1.260.0000.01715.66
7.1.250.0030.00615.60
7.1.200.0030.00915.60
7.1.100.0030.01018.33
7.1.70.0030.00517.30
7.1.60.0100.01619.32
7.1.50.0190.01334.56
7.1.00.0070.07022.40
7.0.200.0030.00516.73
7.0.140.0030.07322.09
7.0.60.0170.07719.84
7.0.50.0030.04317.90
7.0.40.0030.08720.10
7.0.30.0570.06020.13
7.0.20.0170.04720.10
7.0.10.0070.06720.08
7.0.00.0030.04320.08
5.6.280.0000.07720.92
5.6.210.0070.07020.55
5.6.200.0070.05018.25
5.6.190.0000.05320.57
5.6.180.3400.04020.57
5.6.170.0270.06720.62
5.6.160.0100.08020.51
5.6.150.0100.08018.16
5.6.140.0130.03018.10
5.6.130.0130.05318.23
5.6.120.0170.05020.99
5.6.110.0030.08721.04
5.6.100.0170.07321.14
5.6.90.0070.08721.10
5.6.80.0130.06320.36
5.6.70.0300.06720.48
5.5.350.0430.07020.45
5.5.340.0070.05017.92
5.5.330.0100.08020.26
5.5.320.0370.03720.19
5.5.310.0400.07320.30
5.5.300.0070.08018.08
5.5.290.0030.08317.99
5.5.280.0030.04020.88
5.5.270.0030.08720.77
5.5.260.0170.07720.88
5.5.250.0100.05720.57
5.5.240.0270.07720.08
5.4.450.0200.07319.32
5.4.440.0230.03319.46
5.4.430.0200.06319.32
5.4.420.0100.04719.27
5.4.410.0130.04319.19
5.4.400.0230.06719.00
5.4.390.0230.04719.24
5.4.380.0200.07019.08
5.4.370.0230.04019.13
5.4.360.0200.04719.17
5.4.350.0170.03719.25
5.4.340.0270.06718.98
5.4.320.0270.06719.22
5.4.310.0170.04319.13
5.4.300.0230.05319.09
5.4.290.0130.07719.15
5.4.280.0170.08018.96
5.4.270.0270.06318.87
5.4.260.0270.06719.08
5.4.250.0230.04319.12
5.4.240.0230.04018.99
5.4.230.0200.06319.23
5.4.220.0300.07018.94
5.4.210.0270.04319.30
5.4.200.0270.05019.19
5.4.190.0200.07019.31
5.4.180.0170.05718.83
5.4.170.0300.04318.94
5.4.160.0270.06319.09
5.4.150.0200.06018.95
5.4.140.0170.03716.50
5.4.130.0170.03716.34
5.4.120.0170.03716.49
5.4.110.0400.04016.20
5.4.100.0130.04716.21
5.4.90.0300.03716.27
5.4.80.0230.04316.50
5.4.70.0100.05016.48
5.4.60.0130.05716.54
5.4.50.0230.03016.48
5.4.40.0130.04016.48
5.4.30.0130.03016.51
5.4.20.0200.05016.43
5.4.10.0230.04016.48
5.4.00.0170.06015.83
5.3.290.0170.04714.67
5.3.280.0130.04314.66
5.3.270.0170.03714.71
5.3.260.0100.04314.59
5.3.250.0200.04314.52
5.3.240.0200.03314.63
5.3.230.0130.04714.48
5.3.220.0200.03314.48
5.3.210.0200.03314.50
5.3.200.0130.04014.70
5.3.190.0230.03014.68
5.3.180.0100.04314.64
5.3.170.0130.03714.80
5.3.160.0130.06014.65
5.3.150.0200.07014.48
5.3.140.0200.05714.49
5.3.130.0100.05014.65
5.3.120.0230.04014.47
5.3.110.0200.03314.48
5.3.100.0200.04314.06
5.3.90.0200.03714.05
5.3.80.0100.05013.94
5.3.70.0200.06713.93
5.3.60.0170.03713.95
5.3.50.0130.03714.04
5.3.40.0130.04713.89
5.3.30.0170.03313.92
5.3.20.0270.04713.86
5.3.10.0030.03713.60
5.3.00.0130.03713.55
5.2.170.0200.03311.17
5.2.160.0130.03711.11
5.2.150.0130.03011.12
5.2.140.0100.06011.13
5.2.130.0170.02711.27
5.2.120.0170.02311.05
5.2.110.0200.03311.04
5.2.100.0130.03311.07
5.2.90.0100.03011.18
5.2.80.0130.03311.20
5.2.70.0170.05711.04
5.2.60.0130.03010.98
5.2.50.0200.05010.95
5.2.40.0070.04011.09
5.2.30.0100.03011.07
5.2.20.0130.02711.20
5.2.10.0130.05710.96
5.2.00.0130.05010.74
5.1.60.0130.0279.99
5.1.50.0100.02710.00
5.1.40.0130.02710.00
5.1.30.0100.02710.43
5.1.20.0100.04710.39
5.1.10.0100.03310.03
5.1.00.0130.03310.06
5.0.50.0100.0308.45
5.0.40.0070.0238.52
5.0.30.0100.0638.14
5.0.20.0070.0208.39
5.0.10.0030.0378.28
5.0.00.0130.0408.34
4.4.90.0030.0277.81
4.4.80.0070.0207.81
4.4.70.0030.0177.81
4.4.60.0070.0277.81
4.4.50.0100.0137.81
4.4.40.0030.0307.81
4.4.30.0070.0207.81
4.4.20.0070.0337.81
4.4.10.0130.0307.81
4.4.00.0070.0507.81
4.3.110.0070.0237.81
4.3.100.0100.0237.81
4.3.90.0030.0207.81
4.3.80.0100.0437.81
4.3.70.0100.0137.81
4.3.60.0070.0377.81
4.3.50.0130.0107.81
4.3.40.0100.0477.81
4.3.30.0030.0377.81
4.3.20.0030.0337.81
4.3.10.0000.0207.81
4.3.00.0030.0277.81

preferences:
42.94 ms | 401 KiB | 5 Q