3v4l.org

run code in 300+ PHP versions simultaneously
<?php require("db.php"); mysql_connect($DBserver, $DBuser, $DBpass) or die(mysql_error()); mysql_select_db($DBname) or die(mysql_error()); // Get data from the "CRFAds" table $result = mysql_query("SELECT * FROM CRFAds WHERE SubmitterName Like 'David%'") or die(mysql_error()); // Keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { //Get Ad Start Date $AdStartDate = date("F d, Y",strtotime($row['StartDate'])); //Check to see if it is either new (expires in 90 days) or a renewal (expires in 120 days) If ($row['NewOrRenewal']=="Renewal") { $AdExpirationDate = date("F d, Y",strtotime($row['StartDate'] . '+120 days')); //Calculate the difference between expiration date and today to see if it expires within 30 days $today = date("F d, Y"); $DayDiff = abs(strtotime($AdExpirationDate) - strtotime($today)); $DaysToExpiration = floor(($DayDiff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); if ($DaysToExpiration <= 30) { $Expire30 = "Yes"; }else{ $Expire30 = "No"; } }else{ $AdExpirationDate = date("F d, Y",strtotime($row['StartDate'] . '+90 days')); //Calculate the difference between expiration date and today to see if it expires within 30 days $today = date("F d, Y"); $DayDiff1 = abs(strtotime($AdExpirationDate) - strtotime($today)); $DaysToExpiration = floor(($DayDiff1- $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); if ($DaysToExpiration <= 30) { $Expire30 = "Yes"; }else{ $Expire30 = "No"; } } //Calculate the difference between today and start date to see if it is new within the last 30 days $DayDiff2 = abs(strtotime($AdStartDate) - strtotime($today)); $DaysRunning = floor(($DayDiff2- $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); if ($DaysRunning <= 30) { $New30 = "Yes"; }else{ $New30 = "No"; } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: require(): open_basedir restriction in effect. File(db.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/PI9Ln on line 2 Warning: require(db.php): Failed to open stream: Operation not permitted in /in/PI9Ln on line 2 Fatal error: Uncaught Error: Failed opening required 'db.php' (include_path='.:') in /in/PI9Ln:2 Stack trace: #0 {main} thrown in /in/PI9Ln on line 2
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.58 ms | 401 KiB | 8 Q