3v4l.org

run code in 300+ PHP versions simultaneously
<?php $txt = <<<TXT 1 Hello! 2 How 3 are 4 you? TXT; class FileObject extends SplFileObject { public function seek($offset) { if ($offset < 0) { throw new Exception("Can't seek file: " . $this->getPathname() . " to negative offset: $offset"); } $this->rewind(); for ($i = 0; $i < $offset; $i++) { $this->current(); $this->next(); if ($this->eof()) { break; } } $this->current(); } } $file = new FileObject('php://memory', 'w+'); $file->fwrite($txt); echo 'Seeking line 1...', PHP_EOL; $file->seek(0); echo 'Position in the file: ', $file->ftell(), PHP_EOL; echo 'Rest of the file: ', PHP_EOL, $file->fread(5000); echo PHP_EOL, '-------------', PHP_EOL; echo 'Seeking line 2...', PHP_EOL; $file->seek(1); echo 'Position in the file: ', $file->ftell(), PHP_EOL; echo 'Rest of the file: ', PHP_EOL, $file->fread(5000);

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.1.20.0000.00817.74
8.1.10.0100.00517.50
8.1.00.0150.00717.45
8.0.140.0130.00416.85
8.0.130.0110.00716.79
8.0.120.0130.00416.85
8.0.110.0120.00516.87
8.0.100.0120.00416.82
8.0.90.0110.00616.81
8.0.80.0130.00416.87
8.0.70.0150.00316.78
8.0.60.0140.00416.80
8.0.50.0140.00316.83
8.0.30.0120.00616.80
8.0.20.0110.00716.88
8.0.10.0120.00617.02
8.0.00.0080.00216.95
7.4.270.0080.00716.51
7.4.260.0160.00416.51
7.4.250.0130.00716.54
7.4.240.0120.00716.48
7.4.230.0160.00316.48
7.4.220.0110.00516.56
7.4.210.0130.00416.55
7.4.200.0110.00516.46
7.4.190.0110.00616.56
7.4.180.0120.00616.55
7.4.160.0150.00116.53
7.4.150.0160.00316.42
7.4.140.0130.00416.42
7.4.130.0120.00516.42
7.4.120.0130.00416.46
7.4.110.0130.00416.46
7.4.100.0130.00416.51
7.4.90.0150.00216.50
7.4.80.0130.00316.39
7.4.70.0130.00416.37
7.4.60.0100.00616.40
7.4.50.0110.00316.35
7.4.40.0120.00216.32
7.4.30.0110.00316.44
7.4.20.0130.00316.43
7.4.10.0120.00316.38
7.4.00.0100.00516.46
7.3.330.0150.00316.33
7.3.320.0150.00316.40
7.3.310.0140.00316.36
7.3.300.0140.00516.21
7.3.290.0150.00216.35
7.3.280.0130.00516.27
7.3.270.0140.00216.28
7.3.260.0130.00516.36
7.3.250.0130.00316.43
7.3.240.0110.00416.33
7.3.230.0110.00416.31
7.3.220.0080.00616.22
7.3.210.0120.00516.33
7.3.200.0070.00716.25
7.3.190.0100.00616.27
7.3.180.0090.00716.19
7.3.170.0100.00616.20
7.3.160.0110.00616.22
7.3.150.0130.00416.25
7.3.140.0120.00516.21
7.3.130.0130.00416.21
7.3.120.0140.00516.31
7.3.110.0150.00516.18
7.3.100.0190.00016.21
7.3.90.0110.00916.55
7.3.80.0180.00216.35
7.3.70.0160.00316.17
7.3.60.0140.00416.38
7.3.50.0140.00516.37
7.3.40.0140.00516.35
7.3.30.0170.00216.30
7.3.20.0160.00417.27
7.3.10.0150.00417.21
7.3.00.0150.00617.11
7.2.340.0140.00616.50
7.2.330.0170.00516.33
7.2.320.0160.00316.46
7.2.310.0160.00416.47
7.2.300.0130.00716.47
7.2.290.0180.00216.38
7.2.280.0110.00916.39
7.2.270.0100.00916.45
7.2.260.0120.00716.47
7.2.250.0150.00316.32
7.2.240.0140.00516.37
7.2.230.0130.00616.41
7.2.220.0150.00416.29
7.2.210.0130.00616.43
7.2.200.0190.00216.63
7.2.190.0150.00516.56
7.2.180.0110.00916.45
7.2.170.0150.00416.54
7.2.160.0160.00316.53
7.2.150.0100.00917.46
7.2.140.0140.00517.45
7.2.130.0130.00717.57
7.2.120.0180.00217.61
7.2.110.0150.00417.57
7.2.100.0120.00717.64
7.2.90.0200.00617.42
7.2.80.0170.00317.51
7.2.70.0140.00617.46
7.2.60.0160.00417.52
7.2.50.0170.00417.54
7.2.40.0170.00317.50
7.2.30.0120.00817.49
7.2.20.0180.00317.51
7.2.10.0160.00517.67
7.2.00.0190.00117.61
7.1.330.0080.01016.40
7.1.320.0140.00316.41
7.1.310.0120.00516.39
7.1.300.0130.00516.43
7.1.290.0170.00116.38
7.1.280.0120.00716.38
7.1.270.0120.00516.58
7.1.260.0100.00816.44
7.1.250.0140.00416.15
7.1.240.0130.00516.22
7.1.230.0140.00416.28
7.1.220.0140.00416.29
7.1.210.0200.00117.37
7.1.200.0180.00217.25
7.1.190.0140.00417.21
7.1.180.0160.00117.17
7.1.170.0130.00717.07
7.1.160.0180.00117.16
7.1.150.0110.00817.29
7.1.140.0140.00417.14
7.1.130.0170.00217.28
7.1.120.0170.00117.14
7.1.110.0160.00217.28
7.1.100.0150.00417.26
7.1.90.0180.00017.29
7.1.80.0150.00417.37
7.1.70.0140.00416.99
7.1.60.0150.00417.33
7.1.50.0170.00317.30
7.1.40.0160.00317.26
7.1.30.0140.00617.18
7.1.20.0150.00317.18
7.1.10.0120.00517.19
7.1.00.0170.00217.28
7.0.330.0140.00417.06
7.0.320.0160.00216.92
7.0.310.0090.00916.92
7.0.300.0170.00016.96
7.0.290.0150.00317.06
7.0.280.0160.00117.00
7.0.270.0160.00317.00
7.0.260.0120.00616.90
7.0.250.0150.00417.11
7.0.240.0120.00717.18
7.0.230.0120.00517.11
7.0.220.0130.00517.14
7.0.210.0150.00317.08
7.0.200.0120.00617.03
7.0.190.0180.00217.13
7.0.180.0140.00417.09
7.0.170.0150.00317.17
7.0.160.0170.00016.98
7.0.150.0160.00117.04
7.0.140.0140.00317.12
7.0.130.0140.00317.05
7.0.120.0120.00617.19
7.0.110.0150.00117.00
7.0.100.0140.00316.96
7.0.90.0140.00516.93
7.0.80.0150.00317.03
7.0.70.0110.00616.97
7.0.60.0120.00717.02
7.0.50.0120.00516.96
7.0.40.0150.00117.11
7.0.30.0110.00617.13
7.0.20.0150.00316.82
7.0.10.0120.00717.04
7.0.00.0150.00416.93
5.6.400.0120.00615.90
5.6.390.0150.00315.99
5.6.380.0160.00115.92
5.6.370.0190.00015.84
5.6.360.0150.00215.74
5.6.350.0170.00015.82
5.6.340.0130.00415.85
5.6.330.0130.00415.70
5.6.320.0110.00615.81
5.6.310.0170.00015.82
5.6.300.0170.00015.80
5.6.290.0140.00315.88
5.6.280.0150.00215.81
5.6.270.0130.00415.86
5.6.260.0100.00715.87
5.6.250.0140.00415.91
5.6.240.0140.00316.02
5.6.230.0160.00215.87
5.6.220.0110.00616.03
5.6.210.0140.00315.96
5.6.200.0130.00416.01
5.6.190.0090.00816.04
5.6.180.0150.00215.94
5.6.170.0170.00116.08
5.6.160.0110.00616.06
5.6.150.0120.00616.03
5.6.140.0120.00815.84
5.6.130.0100.00615.96
5.6.120.0110.00615.95
5.6.110.0150.00215.90
5.6.100.0170.00215.92
5.6.90.0160.00315.91
5.6.80.0140.00415.90
5.6.70.0130.00315.94
5.6.60.0150.00215.91
5.6.50.0150.00215.77
5.6.40.0130.00315.80
5.6.30.0140.00315.86
5.6.20.0120.00615.77
5.6.10.0120.00515.73
5.6.00.0080.00815.83
5.5.380.0150.00215.92
5.5.370.0090.00815.95
5.5.360.0080.00915.87
5.5.350.0110.00615.90
5.5.340.0150.00315.80
5.5.330.0140.00315.72
5.5.320.0160.00215.74
5.5.310.0130.00515.82
5.5.300.0130.00415.72
5.5.290.0110.00615.74
5.5.280.0170.00015.86
5.5.270.0170.00215.65
5.5.260.0150.00215.83
5.5.250.0160.00215.79
5.5.240.0140.00315.82
5.5.230.0140.00315.68
5.5.220.0110.00615.70
5.5.210.0100.00616.06
5.5.200.0160.00315.77
5.5.190.0120.00415.81
5.5.180.0080.01015.61
5.5.170.0110.00515.63
5.5.160.0120.00415.79
5.5.150.0130.00415.71
5.5.140.0110.00615.47
5.5.130.0110.00615.63
5.5.120.0120.00515.65
5.5.110.0130.00415.59
5.5.100.0130.00315.81
5.5.90.0130.00415.78
5.5.80.0140.00215.95
5.5.70.0150.00115.91
5.5.60.0150.00215.87
5.5.50.0110.00615.96
5.5.40.0150.00215.88
5.5.30.0110.00615.79
5.5.20.0120.00415.88
5.5.10.0100.00615.94
5.5.00.0190.00015.71
5.4.450.0100.00412.66
5.4.440.0120.00212.63
5.4.430.0090.00512.71
5.4.420.0070.00712.74
5.4.410.0070.00612.68
5.4.400.0110.00212.43
5.4.390.0120.00312.64
5.4.380.0120.00212.44
5.4.370.0090.00612.69
5.4.360.0120.00312.70
5.4.350.0100.00412.59
5.4.340.0100.00412.55
5.4.330.0110.00312.54
5.4.320.0120.00112.70
5.4.310.0100.00412.61
5.4.300.0110.00212.60
5.4.290.0130.00012.59
5.4.280.0130.00112.52
5.4.270.0110.00312.58
5.4.260.0100.00412.59
5.4.250.0100.00412.60
5.4.240.0090.00612.53
5.4.230.0070.00712.53
5.4.220.0110.00412.45
5.4.210.0120.00212.60
5.4.200.0110.00412.41
5.4.190.0110.00312.40
5.4.180.0140.00112.45
5.4.170.0140.00012.56
5.4.160.0100.00312.63
5.4.150.0130.00112.44
5.4.140.0100.00412.75
5.4.130.0080.00512.63
5.4.120.0090.00412.56
5.4.110.0120.00212.69
5.4.100.0090.00512.69
5.4.90.0100.00312.66
5.4.80.0100.00312.72
5.4.70.0130.00012.77
5.4.60.0100.00312.87
5.4.50.0080.00512.75
5.4.40.0080.00512.73
5.4.30.0110.00312.78
5.4.20.0140.00012.64
5.4.10.0100.00312.84
5.4.00.0060.00712.54
5.3.290.0140.00013.14
5.3.280.0070.00512.87
5.3.270.0130.00113.09
5.3.260.0120.00213.01
5.3.250.0120.00313.11
5.3.240.0090.00612.82
5.3.230.0150.00012.90
5.3.220.0090.00512.87
5.3.210.0120.00212.88
5.3.200.0080.00612.84
5.3.190.0110.00413.13
5.3.180.0110.00213.17
5.3.170.0110.00313.16
5.3.160.0100.00313.12
5.3.150.0060.00713.14
5.3.140.0080.00613.08
5.3.130.0150.00013.12
5.3.120.0140.00012.96
5.3.110.0080.00513.20
5.3.100.0090.00413.06
5.3.90.0110.00213.04
5.3.80.0090.00312.81
5.3.70.0100.00512.99
5.3.60.0120.00113.07
5.3.50.0130.00112.99
5.3.40.0050.00912.95
5.3.30.0110.00213.16
5.3.20.0100.00513.15
5.3.10.0080.00512.83
5.3.00.0090.00512.71
5.2.170.0060.00412.02
5.2.160.0090.00212.04
5.2.150.0060.00312.03
5.2.140.0050.00511.86
5.2.130.0060.00412.13
5.2.120.0070.00311.90
5.2.110.0070.00412.00
5.2.100.0070.00412.03
5.2.90.0030.00612.12
5.2.80.0050.00511.91
5.2.70.0080.00211.85
5.2.60.0050.00511.83
5.2.50.0090.00111.92
5.2.40.0060.00411.99
5.2.30.0040.00611.81
5.2.20.0040.00611.65
5.2.10.0070.00311.74
5.2.00.0090.00111.64
5.1.60.0060.00210.85
5.1.50.0050.00411.02
5.1.40.0020.00710.98
5.1.30.0050.00411.12
5.1.20.0040.00611.05
5.1.10.0040.00511.17
5.1.00.0080.00110.87
5.0.50.0030.00510.39
5.0.40.0020.00510.39
5.0.30.0030.00410.39
5.0.20.0020.00510.39
5.0.10.0020.00510.39
5.0.00.0050.00210.39
4.4.90.0050.00010.39
4.4.80.0020.00210.39
4.4.70.0030.00110.39
4.4.60.0020.00210.39
4.4.50.0040.00010.39
4.4.40.0050.00010.39
4.4.30.0040.00010.39
4.4.20.0030.00210.39
4.4.10.0020.00210.39
4.4.00.0010.00310.39
4.3.110.0030.00210.39
4.3.100.0030.00110.39
4.3.90.0020.00210.39
4.3.80.0020.00210.39
4.3.70.0020.00210.39
4.3.60.0040.00110.39
4.3.50.0020.00310.39
4.3.40.0000.00410.39
4.3.30.0000.00410.39
4.3.20.0000.00410.39
4.3.10.0000.00310.39
4.3.00.0030.00010.39

preferences:
18.4 ms | 455 KiB | 5 Q