3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> <?php $counter = 0; # https://gist.github.com/NuckChorris/fd73d6744e56545c8def # $url = "https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/674266cc5edf294e70b39e75298dbb52911b7332/2014_season_stats.json"; $url = "https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json"; # Turns URL into JSON $json = file_get_contents($url); # Turns JSON into PHP array() $data = json_decode($json, true); # Target data needed $data = $data['TV']; # Create an empty array() for the foreach loop $sort = array(); # Loop through the array foreach ($data as $key => $row) { # Use for Most Popular $sort[$key] = $row['count']; # Use for Highest Rated #if($row['count'] > 0){ # $sort[$key] = $row['rating']; #} else { # $sort[$key] = 0; #} } # Sort the array by 'count' or 'rating' as defined above array_multisort($sort, SORT_DESC , $data); # Print array into webpage from highest to lowest count foreach ($data as $key => $row) { $counter++; print "<pre>" . $counter . ")<br>" . # Use $key for Genres and Seasons, # Use $row['slug'] for Type. #$key . $row['slug'] . "<br>View: " . $row['count'] . "<br>Rati: " . round($row['rating'], 2) . "<br>" . "<br>Comp: " . $row['distribution']['Completed'] . "<br>Curr: " . $row['distribution']['Currently Watching'] . "<br>Drop: " . $row['distribution']['Dropped'] . "<br>On H: " . $row['distribution']['On Hold'] . "<br>Plan: " . $row['distribution']['Plan to Watch'] . "<br><br></pre>"; } ?> </body> </html>
Output for 7.1.20, 7.2.6
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/vpdvc on line 27 Warning: file_get_contents(): open_basedir restriction in effect. File(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json) is not within the allowed path(s): (/tmp:/in) in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json): failed to open stream: Operation not permitted in /in/vpdvc on line 27 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 39 Warning: array_multisort(): Argument #3 is expected to be an array or a sort flag in /in/vpdvc on line 53 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 56 </body> </html>
Output for 5.4.15 - 5.4.19, 5.4.21 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.1.10, 7.2.0
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/vpdvc on line 27 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 39 Warning: array_multisort(): Argument #3 is expected to be an array or a sort flag in /in/vpdvc on line 53 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 56 </body> </html>
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/vpdvc on line 27 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 39 Warning: array_multisort(): Argument #3 is expected to be an array or a sort flag in /in/vpdvc on line 53 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 56 </body> </html>
Output for 5.3.0 - 5.4.14, 5.4.20
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json): failed to open stream: No such file or directory in /in/vpdvc on line 27 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 39 Warning: array_multisort(): Argument #3 is expected to be an array or a sort flag in /in/vpdvc on line 53 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 56 </body> </html>
Output for 5.2.0 - 5.2.17
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Notice: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json): failed to open stream: No such file or directory in /in/vpdvc on line 27 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 39 Warning: array_multisort(): Argument #3 is expected to be an array or a sort flag in /in/vpdvc on line 53 Warning: Invalid argument supplied for foreach() in /in/vpdvc on line 56 </body> </html>
Output for 5.0.0 - 5.1.6
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Notice: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json): failed to open stream: No such file or directory in /in/vpdvc on line 27 Fatal error: Call to undefined function json_decode() in /in/vpdvc on line 30
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Notice: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json): failed to open stream: No such file or directory in /in/vpdvc on line 27 Fatal error: Call to undefined function: json_decode() in /in/vpdvc on line 30
Process exited with code 255.
Output for 4.3.2 - 4.4.4
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Notice: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json): failed to open stream: No such file or directory in /in/vpdvc on line 27 Fatal error: Call to undefined function: json_decode() in /in/vpdvc on line 30
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<!DOCTYPE html> <html> <head> <title>TOP SECRET</title> <style> pre { font-size: 10pt; font-family: "Fira Code"; font-weight: bold; } </style> </head> <body> Notice: file_get_contents() [http://www.php.net/function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/vpdvc on line 27 Warning: file_get_contents(https://gist.github.com/NuckChorris/fd73d6744e56545c8def/raw/7bad79aead47eddeba5667a422c7f5c00f31fc3a/2014_type_stats.json) [http://www.php.net/function.file-get-contents]: failed to create stream: No such file or directory in /in/vpdvc on line 27 Fatal error: Call to undefined function: json_decode() in /in/vpdvc on line 30