3v4l.org

run code in 300+ PHP versions simultaneously
<?php function proc_diff($text1, $text2, $options='') { $descriptors = [ 0 => [ 'file', '/dev/null', 'r' ], 1 => [ 'pipe', 'w' ], 2 => [ 'pipe', 'w' ], 3 => [ 'pipe', 'r' ], 4 => [ 'pipe', 'r' ], ]; $command = sprintf('diff %s /proc/self/fd/3 /proc/self/fd/4', $options); if( ! $p = proc_open( $command, $descriptors, $pipes ) ) { throw new \Exception('proc_open failed.'); } fwrite($pipes[3], $text1); fwrite($pipes[4], $text2); fclose($pipes[3]); fclose($pipes[4]); $ret = []; $ret['stdout'] = stream_get_contents($pipes[1]); $ret['stderr'] = stream_get_contents($pipes[2]); fclose($pipes[1]); fclose($pipes[2]); $ret['code'] = proc_close($p); return $ret; } $in1 = "foo\nbar\n"; $in2 = "foo\nbar\nbaz\n"; var_dump(proc_diff($in1, $in2, '-u'));

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.0060.01018.55
8.3.50.0100.01018.01
8.3.40.0090.01218.74
8.3.30.0150.00018.67
8.3.20.0030.00520.07
8.3.10.0040.00423.57
8.3.00.0090.00019.56
8.2.180.0060.01518.54
8.2.170.0000.01622.96
8.2.160.0060.01019.06
8.2.150.0080.00024.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0030.00519.77
8.2.110.0030.00720.94
8.2.100.0110.00017.91
8.2.90.0040.00419.02
8.2.80.0040.00417.97
8.2.70.0000.00817.50
8.2.60.0040.00417.93
8.2.50.0000.00918.10
8.2.40.0000.00822.11
8.2.30.0070.00019.20
8.2.20.0040.00418.08
8.2.10.0040.00418.07
8.2.00.0000.00718.07
8.1.280.0150.00325.92
8.1.270.0070.00024.66
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0000.01019.16
8.1.230.0090.00319.07
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0060.00317.36
8.1.190.0000.00816.98
8.1.180.0040.00418.10
8.1.170.0040.00418.53
8.1.160.0040.00419.07
8.1.150.0030.00518.84
8.1.140.0040.00419.46
8.1.130.0030.00318.75
8.1.120.0040.00417.43
8.1.110.0050.00217.25
8.1.100.0000.00817.29
8.1.90.0000.00817.41
8.1.80.0070.00017.40
8.1.70.0000.00717.42
8.1.60.0000.00817.53
8.1.50.0040.00417.57
8.1.40.0060.00317.50
8.1.30.0040.00417.54
8.1.20.0000.00817.73
8.1.10.0060.00317.59
8.1.00.0000.00717.51
8.0.300.0000.00718.77
8.0.290.0070.00016.75
8.0.280.0030.00318.31
8.0.270.0030.00317.09
8.0.260.0030.00317.10
8.0.250.0040.00416.99
8.0.240.0000.00716.97
8.0.230.0070.00016.84
8.0.220.0030.00416.93
8.0.210.0070.00016.82
8.0.200.0030.00316.95
8.0.190.0040.00816.86
8.0.180.0040.00416.90
8.0.170.0000.00716.98
8.0.160.0000.00716.81
8.0.150.0030.00316.85
8.0.140.0000.00716.77
8.0.130.0030.00313.44
8.0.120.0080.00016.87
8.0.110.0080.00016.89
8.0.100.0050.00316.80
8.0.90.0040.00416.98
8.0.80.0030.01316.88
8.0.70.0050.00316.98
8.0.60.0000.00716.95
8.0.50.0000.00816.81
8.0.30.0090.00717.03
8.0.20.0140.00717.41
8.0.10.0070.00016.93
8.0.00.0070.01117.02
7.4.330.0000.00615.55
7.4.320.0030.00316.63
7.4.300.0070.00016.60
7.4.290.0000.00716.55
7.4.280.0030.00516.66
7.4.270.0070.00016.63
7.4.260.0080.00016.64
7.4.250.0030.00616.47
7.4.240.0040.00416.54
7.4.230.0070.00016.38
7.4.220.0040.01416.61
7.4.210.0060.01116.47
7.4.200.0000.00716.61
7.4.160.0100.00716.50
7.4.150.0060.01217.40
7.4.140.0100.01217.86
7.4.130.0100.01316.63
7.4.120.0120.01016.56
7.4.110.0130.00716.57
7.4.100.0130.00316.64
7.4.90.0160.00716.48
7.4.80.0070.01019.39
7.4.70.0100.00716.45
7.4.60.0070.01016.51
7.4.50.0090.00316.56
7.4.40.0100.00616.49
7.4.30.0130.00416.36
7.4.00.0070.00715.11
7.3.330.0000.00513.09
7.3.320.0000.00613.22
7.3.310.0000.00816.19
7.3.300.0000.00616.23
7.3.290.0000.00816.32
7.3.280.0080.01016.32
7.3.270.0150.00617.40
7.3.260.0110.00616.42
7.3.250.0090.00916.45
7.3.240.0110.01016.47
7.3.230.0060.01216.66
7.3.210.0090.00616.50
7.3.200.0100.01016.32
7.3.190.0160.00616.43
7.3.180.0040.01216.31
7.3.170.0130.00316.38
7.3.160.0080.00816.48
7.2.330.0060.01216.81
7.2.320.0150.00316.71
7.2.310.0110.00716.53
7.2.300.0000.01816.75
7.2.290.0090.00916.64
7.2.60.0100.00316.73
7.2.50.0110.00416.68
7.1.200.0070.00715.79
7.1.70.0570.00717.57
7.1.60.0840.01417.57
7.1.50.0940.01017.57
7.1.40.0810.00817.57
7.1.30.0980.00717.57
7.1.20.0780.01017.57
7.1.10.0720.00717.57
7.1.00.0550.00417.57
7.0.200.0820.01517.57
7.0.190.0790.00017.57
7.0.180.0890.00417.57
7.0.170.0770.00417.57
7.0.160.0830.00417.57
7.0.150.1150.01217.57
7.0.140.0500.01517.57
7.0.130.0440.01317.57
7.0.120.0640.00717.57
7.0.110.0420.01117.57
7.0.100.0540.00817.57
7.0.90.0520.00617.57
7.0.80.0720.00717.57
7.0.70.0580.01017.57
7.0.60.0900.01017.57
7.0.50.0790.01417.57
7.0.40.0060.01217.57
7.0.30.0070.00717.57
7.0.20.0000.01317.57
7.0.10.0110.00317.57
7.0.00.0080.01117.57

preferences:
61.93 ms | 400 KiB | 5 Q