3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<html> <head> <title>TimeGame</title> <link href="css and images/forms.css" rel="stylesheet" type="text/css" /> <link href="css and images/style.css" rel="stylesheet" type="text/css" /> </head> <body id="bdy"> <div id="formdiv"> <div id="innerdiv"> <p id="para">Enter Unixtimestamp</p> <form action="q3.php" method="post"> <label for="name">TimeStamp</label><br> <input name="timestamp" placeholder="Timestamp" /> <p class="small">Current Timestamp will be taken by default.</p> <input type="submit" class="awesome" value="Submit" /> </form> </div> <div id="tablediv"> <?php if(isset($_POST["timestamp"])) { ?> <br> <table> <thead> <tr> <th>Format</th> <th>Date</th> </tr> </thead> <tbody> <tr> <?php if ($_POST["timestamp"]==null) { $t = getdate(); } else { $t = getdate($_POST["timestamp"]); } ?> <td>Y-m-d H:i:s</td> <td><?php if ($t['hours']<10) $t['hours']="0".$t['hours']; if ($t['minutes']<10) $t['minutes']="0".$t['minutes']; if ($t['seconds']<10) $t['seconds']="0".$t['seconds']; if ($t['year']<10) $t['year']="0".$t['year']; if ($t['mon']<10) $t['mon']="0".$t['mon']; if ($t['mday']<10) $t['mday']="0".$t['mday']; echo $t['year']."-".$t['mon']."-".$t['mday']." ".$t['hours'].":".$t['minutes'].":".$t['seconds']; ?></td> </tr> <tr> <?php if ($_POST["timestamp"]==null) { $t = getdate(); } else { $t = getdate($_POST["timestamp"]); } ?> <td>Y-m-d</td> <td><?php if ($t['hours']<10) $t['hours']="0".$t['hours']; if ($t['minutes']<10) $t['minutes']="0".$t['minutes']; if ($t['seconds']<10) $t['seconds']="0".$t['seconds']; if ($t['year']<10) $t['year']="0".$t['year']; if ($t['mon']<10) $t['mon']="0".$t['mon']; if ($t['mday']<10) $t['mday']="0".$t['mday']; echo $t['year']."-".$t['mon']."-".$t['mday']; ?></td> </tr> <tr> <?php if ($_POST["timestamp"]==null) { $t = getdate(); } else { $t = getdate($_POST["timestamp"]); } ?> <td>m/d/Y H:i:s</td> <td><?php if ($t['hours']<10) $t['hours']="0".$t['hours']; if ($t['minutes']<10) $t['minutes']="0".$t['minutes']; if ($t['seconds']<10) $t['seconds']="0".$t['seconds']; if ($t['year']<10) $t['year']="0".$t['year']; if ($t['mon']<10) $t['mon']="0".$t['mon']; if ($t['mday']<10) $t['mday']="0".$t['mday']; echo $t['mon']."/".$t['mday']."/".$t['year']." ".$t['hours'].":".$t['minutes'].":".$t['seconds']; ?></td> </tr> <tr> <?php if ($_POST["timestamp"]==null) { $t = getdate(); } else { $t = getdate($_POST["timestamp"]); } ?> <td>m/d/Y</td> <td><?php if ($t['hours']<10) $t['hours']="0".$t['hours']; if ($t['minutes']<10) $t['minutes']="0".$t['minutes']; if ($t['seconds']<10) $t['seconds']="0".$t['seconds']; if ($t['year']<10) $t['year']="0".$t['year']; if ($t['mon']<10) $t['mon']="0".$t['mon']; if ($t['mday']<10) $t['mday']="0".$t['mday']; echo $t['mon']."/".$t['mday']."/".$t['year']; ?></td> </tr> </tbody> </table> </div> </div> <?php $time1=$_POST["timestamp"]; $time2=time(); if ($time1==null) { ?><p class="endp"><?php echo "Difference between Your input and Current time stamp is : 0";?></p><?php } else { ?><p class="endp"><?php echo "Difference between Your input and Current time stamp is : ".($time2-$time1);?></p><?php } } ?> </body> </html>
Output for 5.3.0 - 7.1.0
<html> <head> <title>TimeGame</title> <link href="css and images/forms.css" rel="stylesheet" type="text/css" /> <link href="css and images/style.css" rel="stylesheet" type="text/css" /> </head> <body id="bdy"> <div id="formdiv"> <div id="innerdiv"> <p id="para">Enter Unixtimestamp</p> <form action="q3.php" method="post"> <label for="name">TimeStamp</label><br> <input name="timestamp" placeholder="Timestamp" /> <p class="small">Current Timestamp will be taken by default.</p> <input type="submit" class="awesome" value="Submit" /> </form> </div> <div id="tablediv"> </body> </html>