3v4l.org

run code in 300+ PHP versions simultaneously
<?php class File_stream { static $stream; public $context; private $_position; public function __get($name) { $n = "_" . $name; echo " get {$name} = {$this->$n}\n"; return $this->$n; } public function __set($name, $value) { $n = "_" . $name; echo " set {$name} = {$value}\n"; $this->$n = $value; } function stream_open ($path, $mode) { echo " open\n"; if ($mode != 'r' && $mode != 'rb') { return false; } $this->position = 0; return true; } function stream_read ($length) { echo " reading {$length} at {$this->position}\n"; fseek(self::$stream, $this->position); $bytes = fread(self::$stream, $length); $this->position = $this->position + strlen($bytes); echo " read ", strlen($bytes), " bytes\n"; return $bytes; } function stream_tell () { echo " tell\n"; return $this->position; } function stream_eof () { echo " eof\n"; fseek(self::$stream, $this->position); return feof(self::$stream); } function stream_seek ($offset, $whence = SEEK_SET) { echo " seek from {$this->position} to {$offset}\n"; fseek(self::$stream, $this->position); $result = fseek(self::$stream, $offset, $whence); $this->position = ftell(self::$stream); echo " new position is {$this->position}\n"; return $result; } function stream_stat () { echo " stat\n"; return fstat(self::$stream); } } stream_wrapper_register('request-file', 'File_stream'); $data = '0123456789abcdef'; $stream_direct = fopen('php://temp', 'w+b'); fwrite($stream_direct, $data); rewind($stream_direct); File_stream::$stream = $stream_direct; $stream = fopen('request-file://', 'r'); echo "read 3 =\n", fread($stream, 3), "\n"; echo "tell =\n", ftell($stream), "\n"; echo "seek -1\n"; fseek($stream, -1, SEEK_CUR); echo "tell =\n", ftell($stream), "\n"; echo "read 2 =\n", fread($stream, 2), "\n"; echo "tell =\n", ftell($stream), "\n"; fclose($stream);

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.0090.00618.30
8.3.50.0090.00618.50
8.3.40.0180.00018.67
8.3.30.0030.01918.73
8.3.20.0000.00720.20
8.3.10.0060.00321.95
8.3.00.0060.00617.50
8.2.180.0120.00318.15
8.2.170.0110.00422.96
8.2.160.0100.00319.29
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0060.00322.25
8.2.120.0050.00926.35
8.2.110.0040.00419.39
8.2.100.0040.00717.78
8.2.90.0030.00517.87
8.2.80.0000.00818.79
8.2.70.0000.00817.50
8.2.60.0000.00817.50
8.2.50.0050.00317.63
8.2.40.0030.00720.42
8.2.30.0050.00319.35
8.2.20.0040.00417.72
8.2.10.0050.00218.24
8.2.00.0000.00818.21
8.1.280.0090.00625.92
8.1.270.0080.00023.99
8.1.260.0120.00328.09
8.1.250.0040.00428.09
8.1.240.0060.00622.18
8.1.230.0030.00820.88
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0090.00017.53
8.1.190.0100.00017.35
8.1.180.0030.00618.10
8.1.170.0030.00918.46
8.1.160.0070.00022.22
8.1.150.0000.00820.55
8.1.140.0000.00719.63
8.1.130.0040.00417.82
8.1.120.0000.00717.54
8.1.110.0040.00417.48
8.1.100.0050.00217.54
8.1.90.0080.00017.48
8.1.80.0000.00717.45
8.1.70.0040.00417.41
8.1.60.0040.00417.47
8.1.50.0030.00617.52
8.1.40.0000.00817.55
8.1.30.0000.00817.58
8.1.20.0040.00417.74
8.1.10.0060.00317.59
8.1.00.0040.00417.46
8.0.300.0000.00718.77
8.0.290.0000.00916.88
8.0.280.0000.00718.49
8.0.270.0080.00017.28
8.0.260.0000.00617.27
8.0.250.0050.00516.94
8.0.240.0070.00016.94
8.0.230.0070.00017.13
8.0.220.0000.00816.89
8.0.210.0000.00716.97
8.0.200.0030.00317.04
8.0.190.0070.00017.07
8.0.180.0070.00016.88
8.0.170.0000.00816.99
8.0.160.0000.00716.98
8.0.150.0070.00016.98
8.0.140.0000.00816.88
8.0.130.0030.00313.50
8.0.120.0040.00416.89
8.0.110.0000.00817.05
8.0.100.0070.00016.83
8.0.90.0040.00416.91
8.0.80.0070.01517.00
8.0.70.0000.00817.07
8.0.60.0040.00417.02
8.0.50.0050.00316.86
8.0.30.0110.00516.97
8.0.20.0110.00817.40
8.0.10.0040.00417.09
8.0.00.0130.00716.78
7.4.330.0000.00515.08
7.4.320.0060.00016.64
7.4.300.0040.00416.54
7.4.290.0040.00416.64
7.4.280.0060.00316.45
7.4.270.0000.00716.69
7.4.260.0060.00316.59
7.4.250.0000.00716.54
7.4.240.0000.00716.66
7.4.230.0030.00516.67
7.4.220.0130.00716.57
7.4.210.0060.00816.55
7.4.200.0050.00216.54
7.4.160.0080.00816.78
7.4.150.0060.01417.40
7.4.140.0210.00817.86
7.4.130.0080.01116.65
7.4.120.0140.00316.59
7.4.110.0110.00716.63
7.4.100.0090.01216.59
7.4.90.0110.00816.61
7.4.80.0220.00019.39
7.4.70.0140.00316.50
7.4.60.0100.01316.55
7.4.50.0030.00916.25
7.4.40.0060.01116.64
7.4.30.0040.01416.40
7.4.00.0090.00814.83
7.3.330.0000.00613.30
7.3.320.0050.00013.50
7.3.310.0070.00016.52
7.3.300.0070.00016.50
7.3.290.0040.00416.44
7.3.280.0080.01016.46
7.3.270.0110.00817.40
7.3.260.0130.00616.56
7.3.250.0130.00916.45
7.3.240.0130.00716.58
7.3.230.0100.00716.51
7.3.210.0110.00616.44
7.3.200.0060.01219.39
7.3.190.0060.01216.47
7.3.180.0090.01216.61
7.3.170.0110.00716.54
7.3.160.0100.01016.56
7.3.120.0030.01314.91
7.3.110.0070.01115.05
7.3.100.0070.01015.17
7.3.90.0000.01415.06
7.3.80.0000.01114.71
7.3.70.0090.00615.01
7.3.60.0080.00315.04
7.3.50.0060.00915.01
7.3.40.0090.00614.75
7.3.30.0120.00314.66
7.3.20.0060.00516.73
7.3.10.0070.00816.69
7.3.00.0050.00616.70
7.2.330.0120.00816.66
7.2.320.0130.00616.65
7.2.310.0070.01116.84
7.2.300.0110.00716.59
7.2.290.0040.01316.67
7.2.250.0060.01315.32
7.2.240.0100.00715.06
7.2.230.0030.00915.19
7.2.220.0060.01015.39
7.2.210.0030.00915.20
7.2.200.0050.00515.36
7.2.190.0060.00615.30
7.2.180.0060.01015.13
7.2.170.0070.01015.21
7.2.130.0060.00916.98
7.2.120.0000.01517.11
7.2.110.0040.00816.68
7.2.100.0040.00716.88
7.2.90.0060.00917.19
7.2.80.0100.00316.76
7.2.70.0080.00317.04
7.2.60.0070.00717.10
7.2.50.0110.00416.98
7.2.40.0110.00017.14
7.2.30.0090.00316.93
7.2.20.0080.00316.94
7.2.10.0070.00316.63
7.2.00.0030.01216.86
7.1.330.0080.00815.56
7.1.320.0030.01216.02
7.1.310.0030.00615.63
7.1.300.0000.01515.79
7.1.290.0060.00915.64
7.1.280.0110.00015.89
7.1.270.0070.00715.65
7.1.260.0070.00715.61
7.1.250.0060.00615.86
7.1.200.0060.00815.86
7.1.70.0000.00817.05
7.1.60.0060.00919.26
7.1.00.0030.08022.44
7.0.200.0210.00714.81
7.0.80.0300.06020.02
7.0.70.0470.06320.14
7.0.60.0470.07320.09
7.0.50.0330.06020.33
7.0.40.0430.07720.41
7.0.30.0370.06020.43
7.0.20.0470.08020.38
7.0.10.0370.05720.36
7.0.00.0330.07020.27
5.6.230.0300.06320.66
5.6.220.0130.06020.68
5.6.210.0100.07720.89
5.6.200.0230.06021.20
5.6.190.0170.05721.19
5.6.180.0130.05721.08
5.6.170.0030.07321.14
5.6.160.0100.06321.09
5.6.150.0070.06721.02
5.6.140.0170.05721.16
5.6.130.0170.08021.14
5.6.120.0200.05721.12
5.6.110.0070.07021.17
5.6.100.0100.06321.09
5.6.90.0200.05321.11
5.6.80.0070.06320.49
5.6.70.0200.05320.50
5.6.60.0170.06020.48
5.6.50.0130.07020.50
5.6.40.0170.06020.48
5.6.30.0130.05720.45
5.6.20.0300.04320.40
5.6.10.0130.07020.48
5.6.00.0170.05320.41
5.5.370.0100.06020.58
5.5.360.0230.08020.61
5.5.350.0170.07720.44
5.5.340.0200.05320.84
5.5.330.0200.07320.98
5.5.320.0170.05020.89
5.5.310.0130.06020.88
5.5.300.0130.05720.97
5.5.290.0170.06320.97
5.5.280.0170.05720.95
5.5.270.0230.06720.93
5.5.260.0100.06720.96
5.5.250.0100.06320.78
5.5.240.0170.05320.34
5.5.230.0130.06020.33
5.5.220.0030.06720.23
5.5.210.0130.07020.23
5.5.200.0130.07320.29
5.5.190.0100.06020.21
5.5.180.0130.06320.32
5.5.160.0130.05720.31
5.5.150.0070.06320.15
5.5.140.0100.06320.23
5.5.130.0100.06320.21
5.5.120.0130.05720.32
5.5.110.0170.05320.34
5.5.100.0170.06020.17
5.5.90.0170.06720.04
5.5.80.0100.05720.25
5.5.70.0130.05720.24
5.5.60.0100.06020.02
5.5.50.0130.05720.03
5.5.40.0200.06320.08
5.5.30.0200.07020.08
5.5.20.0070.06720.02
5.5.10.0200.05320.05
5.5.00.0000.07020.08

preferences:
59.51 ms | 401 KiB | 5 Q