3v4l.org

run code in 300+ PHP versions simultaneously
<?php class VariableStream { var $position; var $varname; function stream_open($path, $mode, $options, &$opened_path) { echo "opening\n"; $url = parse_url($path); $this->varname = $url["host"]; $this->position = 0; return true; } function stream_read($count) { echo "reading\n"; $ret = substr($GLOBALS[$this->varname], $this->position, $count); $this->position += strlen($ret); return $ret; } function stream_write($data) { echo "writing\n"; $left = substr($GLOBALS[$this->varname], 0, $this->position); $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); $GLOBALS[$this->varname] = $left . $data . $right; $this->position += strlen($data); return strlen($data); } function stream_tell() { echo "telling\n"; return $this->position; } function stream_eof() { echo "eoffing\n"; return $this->position >= strlen($GLOBALS[$this->varname]); } function stream_seek($offset, $whence) { echo "seeking\n"; if ($whence === SEEK_SET && $offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { $this->position = $offset; return true; } if ($whence === SEEK_CUR && $offset >= 0) { $this->position += $offset; return true; } if ($whence === SEEK_END && strlen($GLOBALS[$this->varname]) + $offset >= 0) { $this->position = strlen($GLOBALS[$this->varname]) + $offset; return true; } return false; } function stream_metadata($path, $option, $var) { echo "metaing\n"; if ($option === STREAM_META_TOUCH) { $url = parse_url($path); $varname = $url["host"]; if (! isset($GLOBALS[$varname])) { $GLOBALS[$varname] = ''; } return true; } return false; } function stream_stat() { echo "stating\n"; return array( 0, // device number 0, // inode number 0, // inode protection mode 0, // number of links 0, // userid of owner 0, // groupid of owner 0, // device type, if inode device strlen($GLOBALS[$this->varname]), // size in bytes time(), // atime - time of last access time(), // mtime - time of last modification time(), // ctime - time of creation -1, // block size of filesystem I/O -1 // number of 512-byte blocks allocated ); } } stream_wrapper_register("var", "VariableStream"); $myvar = "fooey"; $v = include 'var://myvar'; var_dump($v);

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)
7.3.120.0030.01315.21
7.3.110.0050.01014.99
7.3.100.0070.00614.66
7.3.90.0060.00915.05
7.3.80.0070.00414.86
7.3.70.0060.01215.06
7.3.60.0030.01014.86
7.3.50.0120.00015.03
7.3.40.0030.00614.94
7.3.30.0120.00315.02
7.3.20.0040.01216.55
7.3.10.0030.00616.74
7.3.00.0030.01216.34
7.2.240.0060.00915.21
7.2.230.0150.00315.09
7.2.220.0040.00815.38
7.2.210.0070.00715.11
7.2.200.0070.00315.30
7.2.190.0000.01215.25
7.2.180.0050.00515.14
7.2.170.0120.00314.91
7.2.160.0030.01015.23
7.2.150.0030.00616.93
7.2.140.0060.00616.93
7.2.130.0060.00916.66
7.2.120.0030.01017.00
7.2.110.0030.00617.01
7.2.100.0030.00716.94
7.2.90.0090.00316.88
7.2.80.0110.00416.98
7.2.70.0040.00817.08
7.2.60.0090.00816.80
7.2.50.0070.00717.05
7.2.40.0070.00717.06
7.2.30.0060.01016.71
7.2.20.0030.01116.86
7.2.10.0070.00316.97
7.2.00.0010.01018.31
7.1.330.0070.01016.06
7.1.320.0000.01315.79
7.1.310.0130.00315.85
7.1.300.0070.00715.78
7.1.290.0000.01415.57
7.1.280.0040.00815.85
7.1.270.0110.00415.78
7.1.260.0030.00915.93
7.1.250.0100.00315.87
7.1.200.0070.00415.77
7.1.100.0060.00618.20
7.1.70.0000.00817.12
7.1.60.0070.01919.32
7.1.50.0040.01416.95
7.1.00.0000.08022.36
7.0.200.0250.01114.98
7.0.140.0030.07322.07
7.0.110.0130.04019.97
7.0.100.0470.03720.03
7.0.90.0430.08719.94
7.0.80.0570.08020.13
7.0.70.0430.05320.05
7.0.60.0470.07019.72
7.0.50.0600.07020.33
7.0.40.0030.08720.05
7.0.30.0170.07319.97
7.0.20.0070.08020.19
7.0.10.0100.07319.95
7.0.00.0030.08720.06
5.6.280.0030.07720.91
5.6.250.0030.04020.74
5.6.240.0130.03320.66
5.6.230.0100.07020.58
5.6.220.0130.05320.55
5.6.210.0000.09020.74
5.6.200.0200.07021.14
5.6.190.0170.07021.17
5.6.180.0100.08321.05
5.6.170.0070.07321.16
5.6.160.0030.08721.05
5.6.150.0000.08320.97
5.6.140.0100.08320.98
5.6.130.0100.08021.21
5.6.120.0000.09021.29
5.6.110.0070.05020.94
5.6.100.0100.05021.30
5.6.90.0070.07021.14
5.6.80.0030.08320.53
5.6.70.0100.07720.66
5.6.60.0130.07020.52
5.6.50.0100.06020.35
5.6.40.0000.08020.44
5.6.30.0200.04020.59
5.6.20.0170.06720.46
5.6.10.0100.08320.32
5.6.00.0030.05320.50
5.5.380.0100.06720.31
5.5.370.0030.08320.38
5.5.360.0130.08020.36
5.5.350.0130.04020.48
5.5.340.0100.07721.06
5.5.330.0070.08320.77
5.5.320.0100.08021.01
5.5.310.0130.07020.92
5.5.300.0000.08720.99
5.5.290.0130.07721.01
5.5.280.0170.06721.06
5.5.270.0030.08720.82
5.5.260.0070.08720.82
5.5.250.0100.08320.82
5.5.240.0030.08720.14
5.5.230.0100.06020.38
5.5.220.0170.06320.10
5.5.210.0100.04320.18
5.5.200.0100.04720.33
5.5.190.0170.07020.07
5.5.180.0200.06320.39
5.5.160.0030.07020.15
5.5.150.0130.07320.11
5.5.140.0070.06320.30
5.5.130.0070.08720.17
5.5.120.0100.07720.28
5.5.110.0000.07720.38
5.5.100.0000.06320.28
5.5.90.0000.08320.23
5.5.80.0030.08720.07
5.5.70.0070.04720.03
5.5.60.0100.06720.15
5.5.50.0230.06020.15
5.5.40.0100.07020.25
5.5.30.0030.08020.05
5.5.20.0030.07320.15
5.5.10.0030.05020.00
5.5.00.0100.07320.23
5.4.450.0100.07719.51
5.4.440.0130.07319.28
5.4.430.0100.07019.29
5.4.420.0030.07719.63
5.4.410.0070.08019.49
5.4.400.0070.07719.02
5.4.390.0170.06719.02
5.4.380.0030.08018.99
5.4.370.0070.07018.95
5.4.360.0070.08019.32
5.4.350.0000.08319.16
5.4.340.0000.06019.14
5.4.320.0130.07019.24
5.4.310.0030.07719.09
5.4.300.0170.06719.30
5.4.290.0030.07719.31
5.4.280.0030.08019.00
5.4.270.0100.08319.31
5.4.260.0070.05319.01
5.4.250.0070.08019.22
5.4.240.0100.07318.98
5.4.230.0170.06319.16
5.4.220.0070.04719.24
5.4.210.0070.07319.24
5.4.200.0130.07319.16
5.4.190.0000.05319.15
5.4.180.0000.06319.02
5.4.170.0100.06319.17
5.4.160.0030.05719.07
5.4.150.0070.08019.01
5.4.140.0070.04016.59
5.4.130.0030.07316.35
5.4.120.0100.06716.56
5.4.110.0100.06716.57
5.4.100.0070.05316.59
5.4.90.0070.07016.56
5.4.80.0070.07016.53
5.4.70.0070.03316.54
5.4.60.0030.06016.36
5.4.50.0030.04016.48
5.4.40.0100.07016.69
5.4.30.0100.06716.56
5.4.20.0170.06016.47
5.4.10.0030.07016.26
5.4.00.0070.07015.97
5.3.290.0100.08014.56
5.3.280.0070.07314.77
5.3.270.0070.07014.66
5.3.260.0030.06014.50
5.3.250.0070.07314.87
5.3.240.0100.07014.62
5.3.230.0030.08014.76
5.3.220.0170.06714.61
5.3.210.0000.07714.73
5.3.200.0130.06314.60
5.3.190.0030.04314.57
5.3.180.0070.07014.64
5.3.170.0030.07714.46
5.3.160.0100.06314.61
5.3.150.0030.07314.61
5.3.140.0100.07314.73
5.3.130.0170.06714.71
5.3.120.0030.06014.59
5.3.110.0100.07714.73
5.3.100.0130.06313.94
5.3.90.0000.07014.07
5.3.80.0100.07014.12
5.3.70.0030.07714.01
5.3.60.0030.04314.06
5.3.50.0100.07014.12
5.3.40.0170.06314.02
5.3.30.0030.05314.18
5.3.20.0030.04013.76
5.3.10.0130.06713.77
5.3.00.0100.06313.71
5.2.170.0030.03711.19
5.2.160.0070.05711.31
5.2.150.0100.05711.19
5.2.140.0070.06311.20
5.2.130.0030.05711.15
5.2.120.0070.04311.13
5.2.110.0030.06711.27
5.2.100.0070.06311.13
5.2.90.0030.06311.21
5.2.80.0130.05011.21
5.2.70.0070.06011.21
5.2.60.0070.05711.11
5.2.50.0100.05311.02
5.2.40.0070.06011.01
5.2.30.0070.06010.97
5.2.20.0000.06311.00
5.2.10.0100.05010.97
5.2.00.0100.03310.89
5.1.60.0030.03710.29
5.1.50.0130.03710.03
5.1.40.0070.04710.01
5.1.30.0030.05010.38
5.1.20.0000.06310.25
5.1.10.0070.05310.12
5.1.00.0130.0409.94
5.0.50.0000.0438.42
5.0.40.0030.0378.64
5.0.30.0070.0508.26
5.0.20.0000.0278.32
5.0.10.0030.0438.31
5.0.00.0070.0538.26
4.4.90.0000.0208.26
4.4.80.0000.0378.26
4.4.70.0000.0338.26
4.4.60.0030.0308.26
4.4.50.0000.0338.26
4.4.40.0070.0508.26
4.4.30.0070.0338.26
4.4.20.0000.0238.26
4.4.10.0000.0308.26
4.4.00.0000.0538.26
4.3.110.0070.0308.26
4.3.100.0030.0178.26
4.3.90.0030.0308.26
4.3.80.0000.0278.26
4.3.70.0070.0308.26
4.3.60.0030.0308.26
4.3.50.0030.0338.26
4.3.40.0000.0538.26
4.3.30.0000.0378.26
4.3.20.0000.0378.26
4.3.10.0070.0308.26
4.3.00.0000.0338.26

preferences:
40.44 ms | 400 KiB | 5 Q