3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $url = "http://www.mediafire.com/api/folder/get_content.php?folder_key=uetm19hfa6znl&content_type=files"; $parent = json_decode(json_encode((array)simplexml_load_string(file_get_contents($url))),1); $content = $parent["folder_content"]; $results = $content["files"]; write("- Files"); $i = 0; foreach ($results as &$file) { $fname = $file[$i]["filename"]; $fkey = $file[$i]["quickkey"]; write("|- File: " . $fname); write(" |-- File Key: " . $fkey); write(' |-- Download: <a href="' . BuildURL($fname, $fkey) . '">Download!</a>'); $i++; } function write($string) { echo $string . "</br>"; } function BuildURL($name, $key) { $template = "https://www.mediafire.com/download/"; $url = $template . $key; $url = $url . "/" . urlencode($name); return $url; } ?>
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/tVCDS on line 4 Warning: file_get_contents(http://www.mediafire.com/api/folder/get_content.php?folder_key=uetm19hfa6znl&content_type=files): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/tVCDS on line 4 Notice: Undefined index: folder_content in /in/tVCDS on line 5 - Files</br> Warning: Invalid argument supplied for foreach() in /in/tVCDS on line 12
Output for hhvm-3.10.0 - 3.12.0
Warning: Failed to open http://www.mediafire.com/api/folder/get_content.php?folder_key=uetm19hfa6znl&content_type=files (Could not resolve host: www.mediafire.com) in /in/tVCDS on line 4 Notice: Undefined index: folder_content in /in/tVCDS on line 5 - Files</br>
Output for 5.2.6 - 5.2.17
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/tVCDS on line 4 Warning: file_get_contents(http://www.mediafire.com/api/folder/get_content.php?folder_key=uetm19hfa6znl&content_type=files): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/tVCDS on line 4 Notice: Undefined index: folder_content in /in/tVCDS on line 5 - Files</br> Warning: Invalid argument supplied for foreach() in /in/tVCDS on line 12
Output for 5.2.0 - 5.2.5
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/tVCDS on line 4 Warning: file_get_contents(http://www.mediafire.com/api/folder/get_content.php?folder_key=uetm19hfa6znl&content_type=files): failed to open stream: Connection refused in /in/tVCDS on line 4 Notice: Undefined index: folder_content in /in/tVCDS on line 5 - Files</br> Warning: Invalid argument supplied for foreach() in /in/tVCDS on line 12
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_decode() in /in/tVCDS on line 4
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/tVCDS on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/tVCDS on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/tVCDS on line 12
Process exited with code 255.