3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function storefile() { $filename = "10mb.test"; //$time_start = microtime_float(); $filecontent = file_get_contents("http://v2.ustreamix.com/stream.php?id=movies-thriller"); //$time_end = microtime_float(); //$time = $time_end - $time_start; //$speed = 10 / $time; //echo "File Downloaded with" . $speed . " Mb/s of speed."; apc_store($filename,$filecontent); } function fetchfile() { $filename = "10mb.test"; $file = apc_fetch($filename); $quoted = sprintf('"%s"', addcslashes(basename($filename), '"\\')); $size = filesize($file); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $quoted); header('Content-Transfer-Encoding: binary'); header('Connection: Keep-Alive'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . $size); echo $file; } storefile(); fetchfile();
based on uJDuq
Output for 7.0.0 - 7.2.6
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0l6NS on line 13 Warning: file_get_contents(http://v2.ustreamix.com/stream.php?id=movies-thriller): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0l6NS on line 13 Fatal error: Uncaught Error: Call to undefined function apc_store() in /in/0l6NS:18 Stack trace: #0 /in/0l6NS(40): storefile() #1 {main} thrown in /in/0l6NS on line 18
Process exited with code 255.
Output for hhvm-3.15.4
Warning: Failed to open http://v2.ustreamix.com/stream.php?id=movies-thriller (Could not resolve host: v2.ustreamix.com) in /in/0l6NS on line 13
Output for 5.6.0 - 5.6.30
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/0l6NS on line 13 Warning: file_get_contents(http://v2.ustreamix.com/stream.php?id=movies-thriller): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/0l6NS on line 13 Fatal error: Call to undefined function apc_store() in /in/0l6NS on line 18
Process exited with code 255.