3v4l.org

run code in 300+ PHP versions simultaneously
<?php // old and new strings $old = "Foo \r\nFoo\r\nBar\r\nQux"; $new = "Foo\nBar\nBaz"; // convert all line endings to the same type $old = str_replace(["\r\n", "\r"], "\n", $old); $new = str_replace(["\r\n", "\r"], "\n", $new); // seperate into lines $old_lines = explode("\n", $old); $new_lines = explode("\n", $new); // optional: remove whitespace so spaces don't trigger falsely array_walk($old_lines, function(&$value) { $value = trim($value); }); array_walk($new_lines, function(&$value) { $value = trim($value); }); // figure out which one is longer if (count($old_lines) >= count($new_lines)) { $primary = $old_lines; $secondary = $new_lines; } else { $primary = $new_lines; $secondary = $old_lines; } // compare line by line $results = []; foreach ($primary as $key => $value) { if (key_exists($key, $secondary)) { if ($primary[$key] == $secondary[$key]) { $results[] = "MATCH"; } else { $results[] = "DIFFERENT"; } } else { $results[] = "MISSING"; } } var_dump($old_lines); var_dump($new_lines); var_dump($results);

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.4.120.0130.00820.54
8.4.110.0090.00919.09
8.4.100.0130.00817.50
8.4.90.0120.00720.54
8.4.80.0070.00120.60
8.4.70.0080.01118.68
8.4.60.0070.01220.70
8.4.50.0080.01222.44
8.4.40.0150.00617.51
8.4.30.0030.01719.55
8.4.20.0110.00017.67
8.4.10.0060.00617.91
8.3.250.0090.01017.16
8.3.240.0110.00916.80
8.3.230.0110.00916.69
8.3.220.0100.00918.95
8.3.210.0090.00916.71
8.3.200.0040.00516.88
8.3.190.0060.00417.36
8.3.180.0070.00920.63
8.3.170.0130.00017.13
8.3.160.0080.00018.57
8.3.150.0100.01016.55
8.3.140.0080.00019.21
8.3.130.0070.00516.54
8.3.120.0060.00320.95
8.3.110.0030.00620.94
8.3.100.0000.00916.53
8.3.90.0070.00726.77
8.3.80.0060.00618.55
8.3.70.0180.00316.75
8.3.60.0110.00718.68
8.3.50.0120.00817.36
8.3.40.0190.00318.80
8.3.30.0100.00718.53
8.3.20.0000.00818.92
8.3.10.0000.00823.51
8.3.00.0050.00319.68
8.2.290.0100.00917.14
8.2.280.0110.00518.16
8.2.270.0030.01617.30
8.2.260.0120.00617.04
8.2.250.0050.00316.72
8.2.240.0030.00617.19
8.2.230.0060.00322.58
8.2.220.0100.01024.06
8.2.210.0080.00026.77
8.2.200.0090.00018.54
8.2.190.0140.00416.58
8.2.180.0090.00616.63
8.2.170.0150.00022.96
8.2.160.0140.00019.31
8.2.150.0090.00024.18
8.2.140.0050.00224.66
8.2.130.0040.00420.52
8.2.120.0070.01126.35
8.2.110.0060.00622.11
8.2.100.0120.00017.91
8.2.90.0050.00319.26
8.2.80.0000.00817.97
8.2.70.0080.00017.63
8.2.60.0040.00417.93
8.2.50.0030.00618.10
8.2.40.0040.00420.47
8.2.30.0030.00519.24
8.2.20.0000.00818.14
8.2.10.0000.00718.01
8.2.00.0000.00718.16
8.1.330.0110.01216.13
8.1.320.0100.00921.38
8.1.310.0080.00016.76
8.1.300.0030.00618.18
8.1.290.0030.00630.84
8.1.280.0140.00725.92
8.1.270.0050.00224.01
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0030.00722.05
8.1.230.0080.00319.10
8.1.220.0000.00917.80
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0040.00418.59
8.1.160.0040.00418.91
8.1.150.0040.00420.10
8.1.140.0000.00819.58
8.1.130.0030.00318.97
8.1.120.0040.00417.45
8.1.110.0040.00417.48
8.1.100.0030.00517.49
8.1.90.0000.00817.48
8.1.80.0000.00717.45
8.1.70.0030.00317.50
8.1.60.0040.00417.60
8.1.50.0080.00017.51
8.1.40.0040.00417.58
8.1.30.0030.00517.52
8.1.20.0060.00317.58
8.1.10.0000.00817.58
8.1.00.0000.00817.41
8.0.300.0050.00320.12
8.0.290.0000.00716.63
8.0.280.0070.00018.33
8.0.270.0030.00317.27
8.0.260.0000.00618.38
8.0.250.0000.00716.88
8.0.240.0060.00316.93
8.0.230.0040.00416.86
8.0.220.0000.00716.97
8.0.210.0070.00016.80
8.0.200.0030.00516.99
8.0.190.0050.00316.84
8.0.180.0000.00816.85
8.0.170.0000.00716.94
8.0.160.0000.00816.98
8.0.150.0070.00016.91
8.0.140.0080.00016.85
8.0.130.0000.00613.32
8.0.120.0000.00816.84
8.0.110.0050.00216.85
8.0.100.0000.00716.79
8.0.90.0040.00416.84
8.0.80.0040.01116.87
8.0.70.0000.00716.69
8.0.60.0080.00016.97
8.0.50.0050.00216.68
8.0.30.0140.00617.02
8.0.20.0120.00717.40
8.0.10.0040.00416.81
8.0.00.0090.00916.76
7.4.330.0050.00015.55
7.4.320.0060.00016.44
7.4.300.0030.00316.62
7.4.290.0030.00316.60
7.4.280.0040.00416.62
7.4.270.0000.00716.50
7.4.260.0030.00516.62
7.4.250.0040.00416.52
7.4.240.0040.00416.61
7.4.230.0040.00416.72
7.4.220.0120.00916.48
7.4.210.0090.00916.63
7.4.200.0070.00016.68
7.4.160.0120.00416.48
7.4.150.0160.00817.40
7.4.140.0100.01117.86
7.4.130.0140.01016.40
7.4.120.0120.01116.63
7.4.110.0170.00316.67
7.4.100.0060.01016.57
7.4.90.0070.01116.54
7.4.80.0110.01117.87
7.4.70.0060.01116.57
7.4.60.0100.00716.50
7.4.50.0080.01216.55
7.4.40.0050.01316.58
7.4.30.0090.00816.57
7.4.20.0070.00916.43
7.4.10.0090.00916.45
7.4.00.0090.00916.13
7.3.330.0000.00613.24
7.3.320.0060.00013.34
7.3.310.0000.00716.25
7.3.300.0040.00416.33
7.3.290.0030.00316.38
7.3.280.0090.00816.35
7.3.270.0100.00717.40
7.3.260.0060.01216.54
7.3.250.0100.00916.53
7.3.240.0120.00816.65
7.3.230.0100.01016.35
7.3.210.0050.01516.57
7.3.200.0120.00516.54
7.3.190.0100.00716.49
7.3.180.0080.01216.45
7.3.170.0100.00816.43
7.3.160.0060.01116.44
7.3.150.0100.00716.55
7.3.140.0110.00716.57
7.3.130.0100.00616.45
7.3.120.0100.01016.45
7.3.110.0060.01216.43
7.3.100.0080.01316.49
7.3.90.0090.01016.45
7.3.80.0090.01116.38
7.3.70.0060.01116.31
7.3.60.0110.00716.46
7.3.50.0070.01016.27
7.3.40.0050.01316.38
7.3.30.0100.00816.33
7.3.20.0090.00817.06
7.3.10.0370.01016.48
7.3.00.0340.01016.52
7.2.330.0120.00616.79
7.2.320.0070.01016.60
7.2.310.0090.01116.59
7.2.300.0070.01016.58
7.2.290.0090.01316.59
7.2.280.0140.00416.64
7.2.270.0070.01216.63
7.2.260.0060.01416.64
7.2.250.0070.01216.58
7.2.240.0120.00716.71
7.2.230.0130.00416.43
7.2.220.0070.01016.62
7.2.210.0080.00916.64
7.2.200.0060.01116.57
7.2.190.0090.01016.59
7.2.180.0070.01016.69
7.2.170.0080.01316.59
7.2.160.0050.01416.53
7.2.150.0120.00717.17
7.2.140.0100.00917.28
7.2.130.0220.00916.76
7.2.120.0290.01216.63
7.2.110.0300.01016.70
7.2.100.0300.00416.64
7.2.90.0100.00916.68
7.2.80.0160.00516.69
7.2.70.0330.01316.68
7.2.60.0200.01016.78
7.2.50.0230.01016.77
7.2.40.0330.00716.74
7.2.30.0300.00816.76
7.2.20.0240.00916.71
7.2.10.0210.01016.67
7.2.00.0290.00916.71
7.1.330.0160.00916.21
7.1.320.0110.00816.20
7.1.310.0150.00716.30
7.1.300.0140.00816.19
7.1.290.0140.00716.11
7.1.280.0170.00716.17
7.1.270.0130.00816.07
7.1.260.0130.00916.06
7.1.250.0310.00715.56
7.1.240.0300.01315.52
7.1.230.0330.00815.46
7.1.220.0290.00915.51
7.1.210.0270.00515.52
7.1.200.0310.00915.54
7.1.190.0330.00815.55
7.1.180.0250.01015.51
7.1.170.0280.01015.56
7.1.160.0240.01115.47
7.1.150.0320.00815.37
7.1.140.0270.01015.49
7.1.130.0300.00415.50
7.1.120.0190.01415.53
7.1.110.0280.01115.49
7.1.100.0260.01215.54
7.1.90.0300.01015.47
7.1.80.0370.00615.56
7.1.70.0190.01215.99
7.1.60.0190.01116.03
7.1.50.0250.00716.07
7.1.40.0190.00916.05
7.1.30.0230.00816.04
7.1.20.0210.01016.00
7.1.10.0230.00716.04
7.1.00.0240.01016.00
7.0.330.0270.00915.09
7.0.320.0140.01115.10
7.0.310.0310.01315.12
7.0.300.0240.00715.13
7.0.290.0300.00815.02
7.0.280.0240.00915.02
7.0.270.0310.00814.87
7.0.260.0290.01014.96
7.0.250.0310.00815.05
7.0.240.0260.00815.07
7.0.230.0300.01015.01
7.0.220.0470.00915.31
7.0.210.0220.01215.23
7.0.200.0240.00715.74
7.0.190.0190.01015.74
7.0.180.0220.00815.82
7.0.170.0250.00815.83
7.0.160.0270.00715.79
7.0.150.0250.01115.75
7.0.140.0270.00815.75
7.0.130.0220.00815.75
7.0.120.0200.00815.72
7.0.110.0180.00915.73
7.0.100.0200.00915.59
7.0.90.0180.00615.66
7.0.80.0320.00715.61
7.0.70.0170.00815.68
7.0.60.0200.00815.70
7.0.50.0240.00915.73
7.0.40.0210.00615.70
7.0.30.0290.00815.71
7.0.20.0240.00715.76
7.0.10.0180.00815.80
7.0.00.0200.00815.77
5.6.400.0140.01215.95
5.6.390.0070.01615.93
5.6.380.0160.00615.54
5.6.370.0130.01215.41
5.6.360.0110.01315.47
5.6.350.0120.01215.47
5.6.340.0140.01215.54
5.6.330.0140.01115.68
5.6.320.0120.01215.54
5.6.310.0180.00815.46
5.6.300.0140.01616.66
5.6.290.0150.01616.54
5.6.280.0130.01616.68
5.6.270.0120.01816.57
5.6.260.0120.02016.64
5.6.250.0100.01816.58
5.6.240.0120.01816.60
5.6.230.0140.01516.50
5.6.220.0120.01716.60
5.6.210.0150.01616.53
5.6.200.0140.01816.60
5.6.190.0160.01516.64
5.6.180.0140.01516.48
5.6.170.0100.02116.51
5.6.160.0100.02116.59
5.6.150.0130.01616.45
5.6.140.0090.02116.54
5.6.130.0090.02116.55
5.6.120.0120.01816.44
5.6.110.0110.02116.61
5.6.100.0130.01616.65
5.6.90.0130.01816.63
5.6.80.0150.02216.40
5.6.70.0150.01716.40
5.6.60.0130.01816.37
5.6.50.0130.01516.48
5.6.40.0120.01816.27
5.6.30.0150.01516.36
5.6.20.0140.01416.38
5.6.10.0120.01616.48
5.6.00.0140.01616.40

preferences:
28.75 ms | 403 KiB | 5 Q