3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //============================================= MY_MESSAGES.PHP //----------------------------------------------------------- include ("includes/header.php"); ?> <h2>My Unread Messages:</h2><p /> <? //-------------- SPACE -- Grab the messages for the logged in user $grab_messages = $dbh->prepare("SELECT * FROM pvt_messages WHERE user_to=:user && opened='no' && deleted='no'"); $grab_messages->bindValue(':user', $user, PDO::PARAM_STR); $grab_messages->execute(); $numrows = $grab_messages->fetch(PDO::FETCH_ASSOC); //-------------- SPACE if ($numrows != 0) { while ($get_msg = $grab_messages->fetch(PDO::FETCH_ASSOC)){ echo "--".$id = $get_msg['id']; $user_from = $get_msg['user_from']; $user_to = $get_msg['user_to']; $msg_title = $get_msg['msg_title']; $msg_body = $get_msg['msg_body']; $date = $get_msg['date']; $opened = $get_msg['opened']; $deleted = $get_msg['deleted']; ?> <script language="javascript"> function toggle<? echo $id; ?>() { var ele = document.getElementById("toggleText<? echo $id; ?>"); var text = document.getElementById("displayText<? echo $id; ?>"); if (ele.style.display == "block") { ele.style.display = "none"; } else { ele.style.display = "block"; } } </script> <? if (strlen($msg_title) > 50) { $msg_title = substr($msg_title, 0, 50)." ..."; } else $msg_title = $msg_title; if (strlen($msg_body) > 150) { $msg_body = substr($msg_body, 0, 150)." ..."; } else $msg_body = $msg_body; if (@$_POST['setopened_' . $id . '']) { //-------------- SPACE -- Update the private messages table $setopened_query = $dbh->prepare("UPDATE pvt_messages SET opened='yes' WHERE id=:id"); $setopened_query->bindValue(':id', $id, PDO::PARAM_STR); $setopened_query->execute(); } echo " <form method='POST' action='my_messages.php' name='$msg_title'> <b><a href='$user_from'>$user_from</a></b> <input type='button' name='openmsg' value='$msg_title' onClick='javascript:toggle$id()'> <input type='submit' name='setopened_$id' value=\"I've Read This\"> </form> <div id='toggleText$id' style='display: none;'> <br />$msg_body </div> <hr /><br /> "; } } else { echo "You haven't read any messages yet."; } ?>
Output for 7.0.5 - 7.1.0
Warning: include(includes/header.php): failed to open stream: No such file or directory in /in/OA7fB on line 7 Warning: include(): Failed opening 'includes/header.php' for inclusion (include_path='.:') in /in/OA7fB on line 7 <h2>My Unread Messages:</h2><p /> Notice: Undefined variable: dbh in /in/OA7fB on line 17 Fatal error: Uncaught Error: Call to a member function prepare() on null in /in/OA7fB:17 Stack trace: #0 {main} thrown in /in/OA7fB on line 17
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Warning: include(includes/header.php): failed to open stream: No such file or directory in /in/OA7fB on line 7 Warning: include(): Failed opening 'includes/header.php' for inclusion (include_path='.:') in /in/OA7fB on line 7 <h2>My Unread Messages:</h2><p /> Notice: Undefined variable: dbh in /in/OA7fB on line 17 Fatal error: Uncaught Error: Call to a member function prepare() on unknown in /in/OA7fB:17 Stack trace: #0 {main} thrown in /in/OA7fB on line 17
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Warning: File not found: includes/header.php in /in/OA7fB on line 7 <h2>My Unread Messages:</h2><p /> Notice: Undefined variable: dbh in /in/OA7fB on line 17 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function prepare() on a non-object (null)' in /in/OA7fB:17 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Warning: include(includes/header.php): failed to open stream: No such file or directory in /in/OA7fB on line 7 Warning: include(): Failed opening 'includes/header.php' for inclusion (include_path='.:') in /in/OA7fB on line 7 <h2>My Unread Messages:</h2><p /> Notice: Undefined variable: dbh in /in/OA7fB on line 17 Fatal error: Call to a member function prepare() on null in /in/OA7fB on line 17
Process exited with code 255.
Output for 5.4.0 - 5.5.38
Warning: include(includes/header.php): failed to open stream: No such file or directory in /in/OA7fB on line 7 Warning: include(): Failed opening 'includes/header.php' for inclusion (include_path='.:') in /in/OA7fB on line 7 <h2>My Unread Messages:</h2><p /> Notice: Undefined variable: dbh in /in/OA7fB on line 17 Fatal error: Call to a member function prepare() on a non-object in /in/OA7fB on line 17
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Warning: include(includes/header.php): failed to open stream: No such file or directory in /in/OA7fB on line 7 Warning: include(): Failed opening 'includes/header.php' for inclusion (include_path='.:') in /in/OA7fB on line 7 <h2>My Unread Messages:</h2><p /> <? //-------------- SPACE -- Grab the messages for the logged in user $grab_messages = $dbh->prepare("SELECT * FROM pvt_messages WHERE user_to=:user && opened='no' && deleted='no'"); $grab_messages->bindValue(':user', $user, PDO::PARAM_STR); $grab_messages->execute(); $numrows = $grab_messages->fetch(PDO::FETCH_ASSOC); //-------------- SPACE if ($numrows != 0) { while ($get_msg = $grab_messages->fetch(PDO::FETCH_ASSOC)){ echo "--".$id = $get_msg['id']; $user_from = $get_msg['user_from']; $user_to = $get_msg['user_to']; $msg_title = $get_msg['msg_title']; $msg_body = $get_msg['msg_body']; $date = $get_msg['date']; $opened = $get_msg['opened']; $deleted = $get_msg['deleted']; ?> <script language="javascript"> function toggle<? echo $id; ?>() { var ele = document.getElementById("toggleText<? echo $id; ?>"); var text = document.getElementById("displayText<? echo $id; ?>"); if (ele.style.display == "block") { ele.style.display = "none"; } else { ele.style.display = "block"; } } </script> <? if (strlen($msg_title) > 50) { $msg_title = substr($msg_title, 0, 50)." ..."; } else $msg_title = $msg_title; if (strlen($msg_body) > 150) { $msg_body = substr($msg_body, 0, 150)." ..."; } else $msg_body = $msg_body; if (@$_POST['setopened_' . $id . '']) { //-------------- SPACE -- Update the private messages table $setopened_query = $dbh->prepare("UPDATE pvt_messages SET opened='yes' WHERE id=:id"); $setopened_query->bindValue(':id', $id, PDO::PARAM_STR); $setopened_query->execute(); } echo " <form method='POST' action='my_messages.php' name='$msg_title'> <b><a href='$user_from'>$user_from</a></b> <input type='button' name='openmsg' value='$msg_title' onClick='javascript:toggle$id()'> <input type='submit' name='setopened_$id' value=\"I've Read This\"> </form> <div id='toggleText$id' style='display: none;'> <br />$msg_body </div> <hr /><br /> "; } } else { echo "You haven't read any messages yet."; } ?>
Output for 4.3.2 - 5.0.5
Warning: main(includes/header.php): failed to open stream: No such file or directory in /in/OA7fB on line 7 Warning: main(): Failed opening 'includes/header.php' for inclusion (include_path='.:') in /in/OA7fB on line 7 <h2>My Unread Messages:</h2><p /> <? //-------------- SPACE -- Grab the messages for the logged in user $grab_messages = $dbh->prepare("SELECT * FROM pvt_messages WHERE user_to=:user && opened='no' && deleted='no'"); $grab_messages->bindValue(':user', $user, PDO::PARAM_STR); $grab_messages->execute(); $numrows = $grab_messages->fetch(PDO::FETCH_ASSOC); //-------------- SPACE if ($numrows != 0) { while ($get_msg = $grab_messages->fetch(PDO::FETCH_ASSOC)){ echo "--".$id = $get_msg['id']; $user_from = $get_msg['user_from']; $user_to = $get_msg['user_to']; $msg_title = $get_msg['msg_title']; $msg_body = $get_msg['msg_body']; $date = $get_msg['date']; $opened = $get_msg['opened']; $deleted = $get_msg['deleted']; ?> <script language="javascript"> function toggle<? echo $id; ?>() { var ele = document.getElementById("toggleText<? echo $id; ?>"); var text = document.getElementById("displayText<? echo $id; ?>"); if (ele.style.display == "block") { ele.style.display = "none"; } else { ele.style.display = "block"; } } </script> <? if (strlen($msg_title) > 50) { $msg_title = substr($msg_title, 0, 50)." ..."; } else $msg_title = $msg_title; if (strlen($msg_body) > 150) { $msg_body = substr($msg_body, 0, 150)." ..."; } else $msg_body = $msg_body; if (@$_POST['setopened_' . $id . '']) { //-------------- SPACE -- Update the private messages table $setopened_query = $dbh->prepare("UPDATE pvt_messages SET opened='yes' WHERE id=:id"); $setopened_query->bindValue(':id', $id, PDO::PARAM_STR); $setopened_query->execute(); } echo " <form method='POST' action='my_messages.php' name='$msg_title'> <b><a href='$user_from'>$user_from</a></b> <input type='button' name='openmsg' value='$msg_title' onClick='javascript:toggle$id()'> <input type='submit' name='setopened_$id' value=\"I've Read This\"> </form> <div id='toggleText$id' style='display: none;'> <br />$msg_body </div> <hr /><br /> "; } } else { echo "You haven't read any messages yet."; } ?>
Output for 4.3.0 - 4.3.1
Warning: main(includes/header.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/OA7fB on line 7 Warning: main() [http://www.php.net/function.main]: Failed opening 'includes/header.php' for inclusion (include_path='.:') in /in/OA7fB on line 7 <h2>My Unread Messages:</h2><p /> <? //-------------- SPACE -- Grab the messages for the logged in user $grab_messages = $dbh->prepare("SELECT * FROM pvt_messages WHERE user_to=:user && opened='no' && deleted='no'"); $grab_messages->bindValue(':user', $user, PDO::PARAM_STR); $grab_messages->execute(); $numrows = $grab_messages->fetch(PDO::FETCH_ASSOC); //-------------- SPACE if ($numrows != 0) { while ($get_msg = $grab_messages->fetch(PDO::FETCH_ASSOC)){ echo "--".$id = $get_msg['id']; $user_from = $get_msg['user_from']; $user_to = $get_msg['user_to']; $msg_title = $get_msg['msg_title']; $msg_body = $get_msg['msg_body']; $date = $get_msg['date']; $opened = $get_msg['opened']; $deleted = $get_msg['deleted']; ?> <script language="javascript"> function toggle<? echo $id; ?>() { var ele = document.getElementById("toggleText<? echo $id; ?>"); var text = document.getElementById("displayText<? echo $id; ?>"); if (ele.style.display == "block") { ele.style.display = "none"; } else { ele.style.display = "block"; } } </script> <? if (strlen($msg_title) > 50) { $msg_title = substr($msg_title, 0, 50)." ..."; } else $msg_title = $msg_title; if (strlen($msg_body) > 150) { $msg_body = substr($msg_body, 0, 150)." ..."; } else $msg_body = $msg_body; if (@$_POST['setopened_' . $id . '']) { //-------------- SPACE -- Update the private messages table $setopened_query = $dbh->prepare("UPDATE pvt_messages SET opened='yes' WHERE id=:id"); $setopened_query->bindValue(':id', $id, PDO::PARAM_STR); $setopened_query->execute(); } echo " <form method='POST' action='my_messages.php' name='$msg_title'> <b><a href='$user_from'>$user_from</a></b> <input type='button' name='openmsg' value='$msg_title' onClick='javascript:toggle$id()'> <input type='submit' name='setopened_$id' value=\"I've Read This\"> </form> <div id='toggleText$id' style='display: none;'> <br />$msg_body </div> <hr /><br /> "; } } else { echo "You haven't read any messages yet."; } ?>