3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once('config.php'); /* id fullname user_name dp gender dob mood history past_history treatments address fu_plans */ $active='profile'; // page title $pagetitle="View Patient - ".$sitename; $styles.=' .leftcl { padding-right:10px; float: left; width: 200px; border-right: 1px solid #ccc; margin-bottom:10px; } .leftcl a { padding-bottom:5px; padding-top:5px; border-bottom:1px solid #ccc; display:block; } .leftcl a:hover { color:rgb(226,4,4); background:#eee; } .dp { width: 200px; height: 200px; border:1px solid #ccc; } .ptheader { width:509px; padding-left:10px; float:left; margin-bottom:10px; } .h_line { border-bottom:1px solid #ddd;display:block;margin-bottom:10px;overflow:hidden; } .cltitle { //color: rgb(153, 153, 153); color:#666;font-weight: bold;line-height: 15px;text-align: left;word-wrap: break-word;float:left; } .clarea { float:right; display:block; font-family: Verdana, sans-serif; } #posts_container, #photos, #pt_wrapper { clear:both; border-bottom:1px solid #ccc; min-height:300px; margin-top:50px; border-top:1px dashed #ccc; display:block; padding-bottom:20px; } .post { padding-top:20px; padding-bottom:20px; border-bottom:dashed 1px #dedede; overflow:auto; } .post:hover { background:#eee; } .status { word-wrap:break-word; padding:5px; border-bottom:1px solid #ccc; } .status b { color:#006699; } .st_time { font-size:11px; color:#999; font-family:Arial, Helvetica, sans-serif; margin-top:3px; text-align:right; } '; require_once('header.php'); function age($dob) { list($d,$m,$y) = explode('-', $dob); if (($m = (date('m') - $m)) < 0) { $y++; } elseif ($m == 0 && date('d') - $d < 0) { $y++; } return date('Y') - $y; } function time_stamp($session_time) { $time_difference = time() - $session_time ; $seconds = $time_difference ; $minutes = round($time_difference / 60 ); $hours = round($time_difference / 3600 ); $days = round($time_difference / 86400 ); $weeks = round($time_difference / 604800 ); $months = round($time_difference / 2419200 ); $years = round($time_difference / 29030400 ); if($seconds <= 60) { return "$seconds seconds ago"; } else if($minutes <=60) { if($minutes==1) { return "one minute ago"; } else { return "$minutes minutes ago"; } } else if($hours <=24) { if($hours==1) { return "one hour ago"; } else { return "$hours hours ago"; } } else if($days <=7) { if($days==1) { return "one day ago"; } else { return "$days days ago"; } } else if($weeks <=4) { if($weeks==1) { return "one week ago"; } else { return "$weeks weeks ago"; } } else if($months <=12) { if($months==1) { return "one month ago"; } else { return "$months months ago"; } } else { if($years==1) { return "one year ago"; } else { return "$years years ago"; } } } if($_GET['id']){ $id=mysql_real_escape_string($_GET['id']); $uq=mysql_query("SELECT * FROM $tbl2 WHERE id='$id'") or print_r("ERROR"); $u=mysql_fetch_array($uq); if(mysql_num_rows($uq)=='0'){ echo '<h1>Not found</h1>'; echo '<p style="margin-left:20px;">Sorry, you entered an invalid input. <a href="/patients">Click here</a> to go back.</p>'; } else { $age=$u['dob']; $age=age($age); $name=$u['fullname']; $mood=$u['mood']; $user=$u['user_name']; $gender=$u['gender']; $addr=$u['address']; $past_history=$u['past_history']; $history=$u['history']; $treatments=$u['treatments']; $fu_plans=$u['fu_plans']; $dp=$u['dp']; ?> <h1>Profile of <?=$name?></h1> <div class="leftcl"> <img src="<?=$dp?>" class="dp" /> <div style="padding-bottom:30px;margin-top:20px;"> <a href="/patients/<?=$id?>">Profile</a> <a href="/patients/<?=$id?>/photos">View Photos</a> <a href="/patients/<?=$id?>/photos">Guestbook (Comments)</a> </div> </div> <div class="ptheader"> <div class="h_line"> <span class="cltitle">Name: </span> <span class="clarea"><?=$name?></span></div> <div class="h_line"> <span class="cltitle">Age: </span> <span class="clarea"> <?=$age?></span></div> <div class="h_line"> <span class="cltitle">Gender: </span> <span class="clarea"> <?=$gender?></span></div> <div class="h_line"> <span class="cltitle">Mood: </span> <span class="clarea"> <?=$mood?></span></div> <div class="h_line"> <span class="cltitle">Address: </span> <span class="clarea"><?=$addr?></span></div> <div class="h_line"> <span class="cltitle">History: </span> <span class="clarea"><?=$history?></span></div> <div class="h_line"> <span class="cltitle">Past History: </span> <span class="clarea"><?=$past_history?></span></div> <div class="h_line"> <span class="cltitle">Future Plans: </span> <span class="clarea"><?=$fu_plans?></span></div> <div class="h_line"> <span class="cltitle">Treatments: </span> <span class="clarea"><?=$treatments?></span></div> </div> <?php if($_GET['view']=='photos'){ ?> <div id="photos"> <h2 class="h2">Photos</h2> <div class="gallery"> <?php foreach(glob("uploads/folks/images/$user*.*") as $filename){ $filename=' <a class="image-link" href="/thumber.php?img='.$filename.'&h=800" data-lightbox="example-set" title="Image of '.$name.'"><img class="image" src="/thumber.php?img='.$filename.'&h=200" alt="'.$name.'\'s image" width="150" height="150"/></a>'; echo $filename; } ?> </div> </div> <?php } elseif($_GET['view']=='guestbook') { ?> <h2 class="h2">Guestbook</h2> <div id="pt_wrapper"> <?php if($_GET['action']=='add'){ ?> <?php if($_POST['email'] && $_POST['name'] $$ $_POST['comment']){ $time=time(); $sql=mysql_query("INSERT INTO $tbl_name(user, name, email, comment, datetime)VALUES('$user', '$name', '$email', '$comment', '$time')") or die(mysql_error()); echo 'Your comment has been posted! <br/>Click <a href="/patients/'.$id.'/guestbook">here</a> to view the Guestbook.'; } else { ?> <b>Post Your Comment</b> <form id="form1" name="form1" method="post" action=""> Name:<br/> <input name="name" type="text" id="name" size="40" /><br/><br/> Email:<br/> <input name="email" type="text" id="email" size="40" /><br/><br/> Comment:<br/> <textarea name="comment" cols="40" rows="3" id="comment"></textarea><br/><br/> <input type="submit" name="Submit" value="Submit" /> &nbsp; <input type="reset" name="Submit2" value="Reset" /> <?php } } else { ?> <div style="float:right;"><a href="/patients/<?=$user?>/guestbook/add">Add a Comment</a></div> <?php $qcomments=mysql_query("SELECT * FROM guestbook WHERE user='$user' ORDER BY id DESC") or print_r("error fetching comments"); while($post=mysql_fetch_array($qposts)){ echo "<div class=\"post\">"; echo "<div class=\"status\">".$post['comment']."</div>"; echo "<div class=\"st_time\">By ".$post['name']." about ".time_stamp($post['time'])."</div>"; echo "</div>"; } ?> <div align="center"><a href="/patients/<?=$user?>/guestbook/add">Add a Comment</a></div> <?php } ?> </div> <?php } else { ?> <div id="posts_container"> <h2 class="h2">Status Updates</h2> <?php $qposts=mysql_query("SELECT * FROM pt_updates WHERE user='$user' ORDER BY id DESC") or print_r("error fetching status updates"); while($post=mysql_fetch_array($qposts)){ echo "<div class=\"post\">"; echo "<div class=\"status\">".$post['status']."</div>"; echo "<div class=\"st_time\">".time_stamp($post['time'])."</div>"; echo "</div>"; } ?> </div> <?php } ?> <?php } } else { ?> <h1>Patient Profile</h1> <form style="margin-left:20px;" method="GET" action="" > Please enter the id of the person to view his/her profile!<br/> <input class="input" style="margin:20px;" size="50" type="text" name="id" id="id" placeholder="E.g 4535..." /> <input class="btn-submit" type="submit" name="submit" value="Get Profile" /> </form> <?php } require_once('sidebar.php'); require_once('footer.php'); ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.220.0190.04212.47
5.4.210.0150.04312.46
5.4.200.0120.04512.46
5.4.190.0120.04512.46
5.4.180.0140.04512.46
5.4.170.0190.03612.47
5.4.160.0090.04612.47
5.4.150.0110.04312.46
5.4.140.0130.04012.15
5.4.130.0120.04212.13
5.4.120.0140.04212.10
5.4.110.0120.04112.10
5.4.100.0130.04312.10
5.4.90.0150.04512.10
5.4.80.0120.04012.10
5.4.70.0130.04412.09
5.4.60.0120.04212.09
5.4.50.0130.04712.09
5.4.40.0140.05012.08
5.4.30.0100.04512.07
5.4.20.0130.04612.07
5.4.10.0110.04812.08
5.4.00.0110.04611.56
5.3.270.0110.05112.73
5.3.260.0130.04912.72
5.3.250.0110.05112.72
5.3.240.0110.05412.72
5.3.230.0150.06112.71
5.3.220.0150.04512.68
5.3.210.0150.04412.69
5.3.200.0150.05012.69
5.3.190.0200.04112.68
5.3.180.0150.05212.68
5.3.170.0160.04912.68
5.3.160.0200.05912.68
5.3.150.0110.04612.68
5.3.140.0130.04612.67
5.3.130.0140.04712.66
5.3.120.0150.05012.66
5.3.110.0130.04912.67
5.3.100.0190.06512.15
5.3.90.0110.04512.13
5.3.80.0130.04312.12
5.3.70.0150.04512.12
5.3.60.0140.04212.10
5.3.50.0130.04512.05
5.3.40.0140.04312.05
5.3.30.0130.05112.02
5.3.20.0140.05111.79
5.3.10.0150.04411.76
5.3.00.0150.04311.74

preferences:
141.59 ms | 1394 KiB | 7 Q