3v4l.org

run code in 300+ PHP versions simultaneously
<?php //#------------ WORKING ------------------------- $current_date = "08/25/2017"; if(date("l", strtotime($current_date)) == "Saturday"){ $Saturday = strtotime($current_date); }else{ $Saturday = strtotime($current_date . " previous saturday"); } $Friday = strtotime(date("m/d/Y", $Saturday) . " next friday"); echo "This Reporting Week:&nbsp;" . date("m/d/Y", $Saturday) . " to " . date("m/d/Y", $Friday) . "<br/>"; echo "<br/><br/>\n" ; //#------------ NOW IT'S WORKING ---------------------- $previous_week_friday = date("m/d/Y", $Friday-3600*24*7); $previous_week_saturday = date("m/d/Y", $Saturday-3600*24*7); echo "Previous Reporting Week:&nbsp;" . $previous_week_friday . " to " . $previous_week_saturday . "<br/>"; echo "<br/><br/>";
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
This Reporting Week:&nbsp;08/19/2017 to 08/25/2017<br/><br/><br/> Previous Reporting Week:&nbsp;08/18/2017 to 08/12/2017<br/><br/><br/>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 This Reporting Week:&nbsp;08/19/2017 to 08/25/2017<br/><br/><br/> Previous Reporting Week:&nbsp;08/18/2017 to 08/12/2017<br/><br/><br/>

preferences:
199.47 ms | 402 KiB | 288 Q