3v4l.org

run code in 300+ PHP versions simultaneously
<?php // internal include file $qfu = "SELECT * FROM my_friends WHERE (user_id = '$user_id' OR friend_id = '$user_id') AND status = '1'"; $fu = mysql_query($qfu) or die(mysql_error()); $rowfu = mysql_num_rows($fu); if ($rowfu == 0 ) { // the user has no friend echo "No friends!"; } else { while($rowf = mysql_fetch_array($fu)){ if($user_id==$rowf['user_id']){ $fid=$rowf['friend_id']; } else { $fid=$rowf['user_id']; } $querymsgs = "SELECT M.msg_id, M.uid_fk, M.message, M.created, M.privacy, U.fname, U.lname FROM messages M, tbluser U WHERE (U.id='$fid' or U.id='$user_id') and (M.uid_fk='$fid' or M.uid_fk='$fid') and (M.privacy='1' or M.privacy='2') order by M.msg_id desc LIMIT $_i, $limit "; $qmsgs = mysql_query($querymsgs) or die(mysql_error()); $row_msgs = mysql_num_rows($qmsgs); if($row_msgs==0){ continue; } else { $msgs = mysql_fetch_array($qmsgs); $msg_id=$msgs['msg_id']; $orimessage=$msgs['message']; $message=tolink(htmlentities($msgs['message'])); $time=$msgs['created']; $privacy=$msgs['privacy']; if($privacy=='0'){ $privacy='Only Me';} elseif($privacy=='2'){ $privacy='Public';} else { $privacy='Friends';} $uid=$msgs['uid_fk']; $fullname=$msgs['fname']." ".$msgs['lname']; $face=$Wall->Avatar($uid); $commentsarray=$Wall->Comments($msg_id); } ?> <script type="text/javascript"> $(document).ready(function(){$("#stexpand<?php echo $msg_id;?>").oembed("<?php echo $orimessage; ?>",{maxWidth: 400, maxHeight: 300});}); </script> <div class="stbody" id="stbody<?php echo $msg_id;?>"> <div class="stimg"> <img src="<?php echo $face;?>" class='big_face'/> </div> <div class="sttext"> <a class="stdelete" href="#" id="<?php echo $msg_id;?>" title="Delete update">X</a> <b><a href="<?php echo 'http://nitofa.com/browse-user.php?fid='.$uid;?>"><?php echo $fullname;?></a></b> <br/><?php echo $message;?> <div class="sttime"><?php time_stamp($time);?> | <a href='#commentbox<?php echo $msg_id;?>' class='commentopen' id='<?php echo $msg_id;?>' title='Comment'>Comment </a> |<!-- <a href="share.php?msg_id=<?php echo $msg_id;?>">Share</a> |--> <?php include('likeunlike.php'); ?> | <?php echo $privacy;?></div> <div id="stexpandbox"> <div id="stexpand<?php echo $msg_id;?>"></div> </div> <div class="commentcontainer" id="commentload<?php echo $msg_id;?>"> <?php include('load_comments.php'); ?> </div> <div class="commentupdate" style='display:none;' id='commentbox<?php echo $msg_id;?>'> <div class="stcommentimg"> <img src="<?php echo $face;?>" class='small_face'/> </div> <div class="stcommenttext" > <form method="post" action="comment_ajax.php"> <textarea name="comment" class="comment" maxlength="200" id="ctextarea<?php echo $msg_id;?>"></textarea> <br /> <input type="submit" value=" Comment " id="<?php echo $msg_id;?>" class="comment_button"/> </form> </div> </div> </div> </div> <?php } } if(!$_GET['next']){ $page = '2'; } else { $page = $_GET['next']+1; } ?> <a style="text-align:center;margin:0 auto;" href="wall.php?next=<?=$page?>">View More</a>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $user_id in /in/2lYoR on line 4 Warning: Undefined variable $user_id in /in/2lYoR on line 4 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/2lYoR:6 Stack trace: #0 {main} thrown in /in/2lYoR on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: user_id in /in/2lYoR on line 4 Notice: Undefined variable: user_id in /in/2lYoR on line 4 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/2lYoR:6 Stack trace: #0 {main} thrown in /in/2lYoR on line 6
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/2lYoR:6 Stack trace: #0 {main} thrown in /in/2lYoR on line 6
Process exited with code 255.
Output for 5.0.4 - 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
Notice: Undefined variable: user_id in /in/2lYoR on line 4 Notice: Undefined variable: user_id in /in/2lYoR on line 4 Fatal error: Call to undefined function mysql_query() in /in/2lYoR on line 6
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: user_id in /in/2lYoR on line 4 Notice: Undefined variable: user_id in /in/2lYoR on line 4 Fatal error: Call to undefined function mysql_query() in /in/2lYoR on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Notice: Undefined variable: user_id in /in/2lYoR on line 4 Notice: Undefined variable: user_id in /in/2lYoR on line 4 Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/2lYoR on line 6 Warning: mysql_query(): A link to the server could not be established in /in/2lYoR on line 6 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: user_id in /in/2lYoR on line 4 Notice: Undefined variable: user_id in /in/2lYoR on line 4 Warning: mysql_query() [http://www.php.net/function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/2lYoR on line 6 Warning: mysql_query() [http://www.php.net/function.mysql-query]: A link to the server could not be established in /in/2lYoR on line 6 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

preferences:
233.39 ms | 402 KiB | 356 Q