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 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
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.
Output for 8.0.13
Warning: require(db.php): Failed to open stream: No such file or directory 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.
Output for 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, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.3.32 - 7.3.33, 7.4.33
Warning: require(db.php): failed to open stream: No such file or directory in /in/PI9Ln on line 2 Fatal error: require(): Failed opening required 'db.php' (include_path='.:') in /in/PI9Ln on line 2
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.32
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: require(): Failed opening required 'db.php' (include_path='.:') in /in/PI9Ln on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5
Warning: main(db.php): failed to open stream: No such file or directory in /in/PI9Ln on line 2 Fatal error: main(): Failed opening required 'db.php' (include_path='.:') in /in/PI9Ln on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: main(db.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/PI9Ln on line 2 Fatal error: main() [http://www.php.net/function.main]: Failed opening required 'db.php' (include_path='.:') in /in/PI9Ln on line 2

preferences:
284.79 ms | 402 KiB | 377 Q