3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: include(): open_basedir restriction in effect. File(includes/header.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/OA7fB on line 7 Warning: include(includes/header.php): Failed to open stream: Operation not permitted 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 8.0.13
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 /> Warning: 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.5 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.4.33
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.1.26 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.32
Warning: include(): open_basedir restriction in effect. File(includes/header.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/OA7fB on line 7 Warning: include(includes/header.php): failed to open stream: Operation not permitted 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 7.3.32 - 7.3.33, 7.4.26
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 /> 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.1.20, 7.2.6
Warning: include(): open_basedir restriction in effect. File(includes/header.php) is not within the allowed path(s): (/tmp:/in) in /in/OA7fB on line 7 Warning: include(includes/header.php): failed to open stream: Operation not permitted 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 5.6.0 - 5.6.30
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.4.45, 5.5.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.1.6, 5.2.0 - 5.2.17, 5.3.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 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 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."; } ?>

preferences:
309.86 ms | 409 KiB | 401 Q