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); if(strpos($commentsString, 'Comment Type:') !== 0){ $comments[] = array( 'type'=>'Text Only', 'body'=>$commentsString, 'by'=>'', 'date'=>'' ); } else { 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.31
8.3.50.0120.01021.91
8.3.40.0040.01118.79
8.3.30.0000.01619.04
8.3.20.0050.00320.34
8.3.10.0080.00020.66
8.3.00.0040.00419.67
8.2.180.0140.00716.63
8.2.170.0110.00422.96
8.2.160.0030.01020.41
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00022.27
8.2.110.0170.00022.08
8.2.100.0030.00919.37
8.2.90.0000.00817.63
8.2.80.0000.00918.83
8.2.70.0040.00418.04
8.2.60.0040.00418.22
8.2.50.0030.00619.21
8.2.40.0030.00621.02
8.2.30.0000.00819.16
8.2.20.0000.00817.77
8.2.10.0080.00018.07
8.2.00.0000.00917.68
8.1.280.0120.00325.92
8.1.270.0080.00022.02
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0060.00323.82
8.1.230.0120.00020.84
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0060.00317.25
8.1.190.0050.00317.10
8.1.180.0050.00318.97
8.1.170.0030.00618.41
8.1.160.0070.00023.79
8.1.150.0040.00418.76
8.1.140.0030.00517.44
8.1.130.0000.00717.84
8.1.120.0000.00717.27
8.1.110.0040.00417.42
8.1.100.0070.00017.29
8.1.90.0000.00817.30
8.1.80.0040.00417.44
8.1.70.0030.00317.33
8.1.60.0080.00017.39
8.1.50.0000.00917.46
8.1.40.0000.00817.48
8.1.30.0000.00817.56
8.1.20.0030.00617.59
8.1.10.0040.00417.59
8.1.00.0050.00417.50
8.0.300.0030.00918.77
8.0.290.0030.00616.63
8.0.280.0030.00318.40
8.0.270.0030.00317.26
8.0.260.0060.00017.26
8.0.250.0000.00716.91
8.0.240.0030.00516.78
8.0.230.0030.00316.93
8.0.220.0000.00716.75
8.0.210.0000.00816.90
8.0.200.0050.00216.90
8.0.190.0040.00416.78
8.0.180.0070.00016.92
8.0.170.0050.00316.87
8.0.160.0000.00816.86
8.0.150.0000.00816.83
8.0.140.0040.00416.84
8.0.130.0060.00013.33
8.0.120.0060.00316.79
8.0.110.0070.00016.80
8.0.100.0040.00416.91
8.0.90.0040.00416.82
8.0.80.0030.01316.87
8.0.70.0000.00716.82
8.0.60.0000.00716.90
8.0.50.0040.00416.70
8.0.30.0070.01917.29
8.0.20.0120.01117.40
8.0.10.0040.00416.83
8.0.00.0110.00916.74
7.4.330.0030.00315.16
7.4.320.0000.00616.50
7.4.300.0000.00716.52
7.4.290.0040.00416.46
7.4.280.0080.00316.64
7.4.270.0000.00716.63
7.4.260.0030.00316.63
7.4.250.0040.00416.48
7.4.240.0040.00316.60
7.4.230.0040.00416.62
7.4.220.0040.01716.48
7.4.210.0030.01716.45
7.4.200.0000.00716.64
7.4.160.0080.00816.56
7.4.150.0200.02717.40
7.4.140.0050.01217.86
7.4.130.0150.00316.59
7.4.120.0100.00716.54
7.4.110.0130.00316.53
7.4.100.0140.00316.54
7.4.90.0150.00316.42
7.4.80.0090.00916.56
7.4.70.0100.01016.66
7.4.60.0060.01316.56
7.4.50.0070.00016.61
7.4.40.0060.01516.58
7.4.30.0060.01116.50
7.4.10.0120.00615.06
7.4.00.0080.01015.07
7.3.330.0020.00213.26
7.3.320.0000.00813.10
7.3.310.0040.00416.36
7.3.300.0030.00316.32
7.3.290.0060.01216.32
7.3.280.0100.00416.29
7.3.270.0090.00917.40
7.3.260.0120.00616.68
7.3.250.0050.01316.45
7.3.240.0090.00916.36
7.3.230.0140.00716.39
7.3.210.0030.01416.55
7.3.200.0070.01519.39
7.3.190.0060.01116.44
7.3.180.0060.00916.45
7.3.170.0160.00616.51
7.3.160.0030.01416.45
7.3.130.0030.01514.81
7.3.120.0150.00314.45
7.3.110.0140.00315.13
7.3.100.0060.00914.78
7.3.90.0100.00714.95
7.3.80.0030.00614.90
7.3.70.0090.00614.99
7.3.60.0000.01414.72
7.3.50.0070.00414.63
7.3.40.0060.00614.64
7.3.30.0000.01014.90
7.3.20.0100.00716.57
7.3.10.0050.00516.57
7.3.00.0090.00216.53
7.2.330.0090.00916.56
7.2.320.0040.01316.68
7.2.310.0040.01616.65
7.2.300.0060.01616.53
7.2.290.0170.00616.54
7.2.260.0070.00715.10
7.2.250.0080.01114.63
7.2.240.0030.01015.11
7.2.230.0060.01015.15
7.2.220.0100.00714.84
7.2.210.0040.00815.08
7.2.200.0150.00315.16
7.2.190.0030.01214.91
7.2.180.0000.01615.16
7.2.170.0030.01314.81
7.2.160.0070.00314.97
7.2.150.0130.00016.54
7.2.140.0000.01816.83
7.2.130.0020.01316.78
7.2.120.0070.00516.86
7.2.110.0090.00716.87
7.2.100.0090.00316.90
7.2.90.0030.00916.78
7.2.80.0090.00516.87
7.2.70.0070.00816.80
7.2.60.0050.01116.96
7.2.50.0100.00716.80
7.2.40.0030.01217.05
7.2.30.0060.00816.86
7.2.20.0030.00916.78
7.2.10.0070.00716.90
7.2.00.0110.00416.78
7.1.330.0060.00915.81
7.1.320.0030.01315.54
7.1.310.0140.00315.90
7.1.300.0080.00415.80
7.1.290.0090.00615.67
7.1.280.0040.00815.91
7.1.270.0080.00415.51
7.1.260.0080.00815.54
7.1.250.0090.00615.86
7.1.240.0070.00515.65
7.1.230.0070.00615.74
7.1.220.0070.00515.80
7.1.210.0030.00815.79
7.1.200.0090.00415.76
7.1.190.0020.01115.72
7.1.180.0050.01115.57
7.1.170.0040.01115.63
7.1.160.0060.00715.64
7.1.150.0080.00615.70
7.1.140.0090.00415.81
7.1.130.0050.00915.86
7.1.120.0050.00815.91
7.1.110.0130.00015.89
7.1.100.0070.00616.53
7.1.90.0090.00515.72
7.1.80.0030.01215.72
7.1.70.0020.00916.07
7.1.60.0090.01016.88
7.1.50.0070.01116.16
7.1.40.0100.00815.63
7.1.30.0050.00715.90
7.1.20.0020.00815.77
7.1.10.0090.00615.74
7.1.00.0050.02817.80
7.0.330.0040.00715.49
7.0.320.0040.00915.38
7.0.310.0060.00515.53
7.0.300.0030.00815.23
7.0.290.0030.01015.43
7.0.280.0060.00615.32
7.0.270.0080.00715.43
7.0.260.0070.00615.25
7.0.250.0070.00615.39
7.0.240.0110.00315.29
7.0.230.0020.01115.33
7.0.220.0100.00715.45
7.0.210.0040.00915.46
7.0.200.0020.00915.89
7.0.190.0080.00515.50
7.0.180.0050.01015.27
7.0.170.0100.00315.35
7.0.160.0040.01115.45
7.0.150.0030.00815.35
7.0.140.0030.03217.59
7.0.130.0050.00715.44
7.0.120.0060.00815.50
7.0.110.0100.00415.37
7.0.100.0020.01215.57
7.0.90.0050.00815.50
7.0.80.0060.00615.31
7.0.70.0050.00715.43
7.0.60.0050.02916.88
7.0.50.0050.02316.30
7.0.40.0080.03015.71
7.0.30.0130.02015.52
7.0.20.0120.03315.80
7.0.10.0060.03415.63
7.0.00.0070.03315.61
5.6.400.0000.00914.07
5.6.390.0110.00314.68
5.6.380.0090.00614.08
5.6.370.0030.01114.26
5.6.360.0060.00714.40
5.6.350.0070.00814.43
5.6.340.0020.01114.46
5.6.330.0050.00814.34
5.6.320.0020.00914.50
5.6.310.0050.00814.36
5.6.300.0090.00314.36
5.6.290.0100.00514.34
5.6.280.0070.02916.74
5.6.270.0050.01014.29
5.6.260.0100.00614.25
5.6.250.0050.01014.38
5.6.240.0100.00514.54
5.6.230.0080.00514.50
5.6.220.0080.00514.42
5.6.210.0090.01616.53
5.6.200.0060.02915.56
5.6.190.0040.02216.47
5.6.180.0210.02116.47
5.6.170.0160.02116.30
5.6.160.0090.03016.46
5.6.150.0070.01615.66
5.6.140.0040.03515.71
5.6.130.0050.03115.54
5.6.120.0100.03016.51
5.6.110.0090.02616.59
5.6.100.0080.02116.50
5.6.90.0060.03016.59
5.6.80.0020.03916.42
5.6.70.0020.01314.14
5.6.60.0110.01014.38
5.6.50.0100.00614.46
5.6.40.0070.00814.39
5.6.30.0050.01214.32
5.6.20.0090.00414.07
5.6.10.0050.00814.23
5.6.00.0040.01014.41
5.5.380.0030.01012.77
5.5.370.0060.00912.83
5.5.360.0090.00412.77
5.5.350.0110.03215.28
5.5.340.0060.02914.45
5.5.330.0030.02515.33
5.5.320.0140.01815.30
5.5.310.0130.01415.26
5.5.300.0090.02314.50
5.5.290.0040.02314.53
5.5.280.0060.02315.49
5.5.270.0030.03415.47
5.5.260.0090.02515.44
5.5.250.0040.02115.41
5.5.240.0070.03115.31
5.5.230.0060.00612.83
5.5.220.0080.00412.84
5.5.210.0040.00712.55
5.5.200.0080.00512.73
5.5.190.0020.00912.55
5.5.180.0050.00712.71
5.5.170.0080.00312.79
5.5.160.0030.00612.61
5.5.150.0020.01012.63
5.5.140.0060.00712.64
5.5.130.0060.00912.74
5.5.120.0060.00912.67
5.5.110.0030.00812.76
5.5.100.0050.00512.53
5.5.90.0020.01012.62
5.5.80.0100.00312.87
5.5.70.0040.00912.71
5.5.60.0110.00112.76
5.5.50.0070.00612.57
5.5.40.0040.00712.78
5.5.30.0060.00812.60
5.5.20.0060.00412.64
5.5.10.0070.00612.81
5.5.00.0040.00812.66
5.4.450.0160.02413.88
5.4.440.0230.02614.00
5.4.430.0300.03113.88
5.4.420.0290.02213.78
5.4.410.0060.02113.86
5.4.400.0330.02213.84
5.4.390.0230.03513.71
5.4.380.0140.02013.66
5.4.370.0250.02513.69
5.4.360.0200.01913.67
5.4.350.0140.02413.70
5.4.340.0120.02013.65
5.4.330.0020.00711.19
5.4.320.0040.01811.54
5.4.310.0060.02011.58
5.4.300.0050.02111.53
5.4.290.0060.01711.61
5.4.280.0020.01811.47
5.4.270.0080.01411.37
5.4.260.0050.01511.54
5.4.250.0040.01711.49
5.4.240.0040.01711.61
5.4.230.0070.01511.61
5.4.220.0080.01611.54
5.4.210.0060.01711.39
5.4.200.0040.01811.52
5.4.190.0050.01711.54
5.4.180.0030.01511.47
5.4.170.0030.01911.52
5.4.160.0050.01711.56
5.4.150.0070.01511.51
5.4.140.0040.01611.40
5.4.130.0050.01511.40
5.4.120.0030.01711.41
5.4.110.0060.01611.44
5.4.100.0060.01511.41
5.4.90.0040.01711.39
5.4.80.0070.01811.37
5.4.70.0050.01511.45
5.4.60.0050.01511.44
5.4.50.0080.01611.35
5.4.40.0060.01511.33
5.4.30.0030.01811.37
5.4.20.0060.01511.46
5.4.10.0070.01611.43
5.4.00.0030.01711.13
5.3.290.0050.02211.99
5.3.280.0050.02311.94
5.3.270.0050.02211.95
5.3.260.0040.02411.95
5.3.250.0100.01911.95
5.3.240.0070.02011.95
5.3.230.0110.02311.94
5.3.220.0070.02111.93
5.3.210.0060.02211.93
5.3.200.0060.02111.93
5.3.190.0070.02011.92
5.3.180.0040.02111.92
5.3.170.0050.02111.92
5.3.160.0030.02311.92
5.3.150.0040.02111.93
5.3.140.0060.02011.92
5.3.130.0050.02411.91
5.3.120.0060.02411.92
5.3.110.0030.02411.92
5.3.100.0080.01711.65
5.3.90.0070.02011.63
5.3.80.0060.02111.63
5.3.70.0050.02311.63
5.3.60.0090.01911.62
5.3.50.0080.01911.59
5.3.40.0070.02211.59
5.3.30.0060.02111.57
5.3.20.0040.02011.46
5.3.10.0060.02011.44
5.3.00.0060.01911.44
5.2.170.0070.01610.19
5.2.160.0060.01610.19
5.2.150.0070.01510.19
5.2.140.0070.01610.19
5.2.130.0050.01610.17
5.2.120.0060.01510.17
5.2.110.0070.01510.17
5.2.100.0040.01910.16
5.2.90.0040.01810.16
5.2.80.0040.01710.16
5.2.70.0020.02010.16
5.2.60.0020.02010.14
5.2.50.0070.01610.13
5.2.40.0080.01510.12
5.2.30.0060.01610.10
5.2.20.0040.01910.10
5.2.10.0030.01910.06
5.2.00.0010.0219.98
5.1.60.0050.0159.63
5.1.50.0050.0129.63
5.1.40.0040.0159.62
5.1.30.0060.0179.79
5.1.20.0040.0159.80
5.1.10.0030.0159.67
5.1.00.0040.0159.67
5.0.50.0040.0118.91
5.0.40.0040.0118.84
5.0.30.0050.0198.74
5.0.20.0060.0118.73
5.0.10.0040.0118.72
5.0.00.0030.0178.71
4.4.90.0040.0097.98
4.4.80.0010.0117.97
4.4.70.0020.0107.97
4.4.60.0030.0097.96
4.4.50.0040.0097.97
4.4.40.0030.0157.94
4.4.30.0050.0077.97
4.4.20.0020.0138.01
4.4.10.0050.0098.01
4.4.00.0010.0177.97
4.3.110.0010.0117.92
4.3.100.0010.0117.92
4.3.90.0010.0157.90
4.3.80.0020.0157.88
4.3.70.0020.0097.90
4.3.60.0030.0107.90
4.3.50.0030.0107.90
4.3.40.0010.0167.86
4.3.30.0000.0127.24
4.3.20.0030.0127.23
4.3.10.0020.0117.21
4.3.00.0060.0118.95

preferences:
42.64 ms | 401 KiB | 5 Q