3v4l.org

run code in 300+ PHP versions simultaneously
<?php function db_news_restart() { mysql_query("DROP TABLE IF EXISTS news"); mysql_query(" CREATE TABLE news ( id INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, header longtext, text longtext, author longtext, lastedit longtext); "); } function db_news_create($header, $text, $author) { $set = array(); $set["header"] = "'" . mysql_real_escape_string($header) . "'"; $set["text"] = "'" . mysql_real_escape_string($text) . "'"; $set["author"] = "'" . mysql_real_escape_string($author) . "'"; $set["lastedit"] = "'" . time() . "'"; mysql_query("INSERT INTO news (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")"); } function db_news_edit($id, $header, $text) { mysql_query("UPDATE news SET header = '" . mysql_real_escape_string($header) . "', text = '" . mysql_real_escape_string($text) . "' WHERE id = '" . mysql_real_escape_string($id) . "'") or die(mysql_error()); } function db_news_remove($id) { mysql_query("DELETE FROM news WHERE id = '" . mysql_real_escape_string($id) . "'") or die(mysql_error()); } function db_news_globalGET($id, $what) { $query = mysql_query("SELECT * FROM news WHERE id='" . mysql_real_escape_string($id) . "'"); $get = mysql_fetch_array($query, MYSQL_ASSOC); return $get[$what]; } function db_news_header($id) { return db_news_globalGET($id, "header"); } function db_news_text($id) { return db_news_globalGET($id, "text"); } function db_news_author($id) { return db_news_globalGET($id, "author"); } function db_news_lastedit($id) { return db_news_globalGET($id, "lastedit"); } ?>
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.24, 7.3.0 - 7.3.12

preferences:
190.5 ms | 408 KiB | 262 Q