3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header('Content-Type: text/html; charset=UTF-8'); date_default_timezone_set('America/Los_Angeles'); echo memory_get_usage() . "\n"; $con = mysqli_connect("localhost", "***", "***", '***'); $result = mysqli_query($con,"SELECT * FROM **_streams"); while($row = mysqli_fetch_array($result)) { $json_array = json_decode(file_get_contents('https://api.twitch.tv/kraken/streams/'.strtolower($row['channel'])), true); if ($json_array['stream'] != NULL) { // turn them into variables to prevent outside SQL injection $displayname = mysqli_real_escape_string($con,$json_array['stream']['channel']['display_name']); $title = mysqli_real_escape_string($con,$json_array['stream']['channel']['status']); $game = mysqli_real_escape_string($con,$json_array['stream']['channel']['game']); $viewers = mysqli_real_escape_string($con,$json_array['stream']['viewers']); $preview = mysqli_real_escape_string($con,$json_array['stream']['preview']['medium']); $followers = mysqli_real_escape_string($con,$json_array['stream']['channel']['followers']); $date = date('m/d/Y h:i:s a', time()); mysqli_query($con,"SET NAMES utf8mb4"); mysqli_query($con,"UPDATE mybb_streams SET `online` = '1', `title` = '$title', `viewers` = '$viewers', `game` = '$game', `preview` = '$preview', `followers` = '$followers', `lastactive` = '$date' WHERE `channel` = '".strtolower($row['channel'])."'") or die("A MySQL error has occurred.<br />Your Query: UPDATE `streams` SET `online` = `1`, `title` = `$title`, `viewers` = `$viewers`, `game` = `$game`, `preview` = `$preview` WHERE channel = '".strtolower($row['channel'])."'<br /> Error: (" . mysqli_errno($con) . ") " . mysqli_error($con)); } else { mysqli_query($con,"UPDATE mybb_streams SET `online` = '0', `viewers` = '0' WHERE `channel` = '".strtolower($row['channel'])."'") or die("A MySQL error has occurred.<br />Your Query: UPDATE streams SET `online` = '0', `viewers` = '0' WHERE `channel` = '".strtolower($row['channel'])."'<br /> Error: (" . mysqli_errno($con) . ") " . mysqli_error($con)); } } echo memory_get_usage() . "\n"; ?>
based on 2p8L6
Output for 7.1.0
358624 Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /in/3uQl4:7 Stack trace: #0 {main} thrown in /in/3uQl4 on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.14
358576 Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /in/3uQl4:7 Stack trace: #0 {main} thrown in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.5.0 - 5.6.28
229000 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.4.10 - 5.4.45
229520 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.4.0 - 5.4.9
228992 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.3.11 - 5.3.29
643360 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.10
643056 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.2.10 - 5.2.17
100624 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.2.7 - 5.2.9
101744 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.2.3 - 5.2.6
102064 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.2.1 - 5.2.2
115032 Fatal error: Call to undefined function mysqli_connect() in /in/3uQl4 on line 7
Process exited with code 255.
Output for 5.1.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/3uQl4 on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/3uQl4 on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: date_default_timezone_set() in /in/3uQl4 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: date_default_timezone_set() in /in/3uQl4 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: date_default_timezone_set() in /in/3uQl4 on line 4