3v4l.org

run code in 300+ PHP versions simultaneously
<?php $outOfStock = true; echo date('d-m-Y') , "\n"; // as baseline $deliveryDate = date('d-m-Y', strtotime('+' . 1+$outOfStock . ' day')); // treat bool as int: instock=1, outofstock=2 echo $deliveryDate , "\n"; // as proof $allHolidays = array('17-05-2018', '18-05-2018', '19-05-2018'); while(in_array($deliveryDate,$allHolidays)){ $deliveryDate = date('d-m-Y', strtotime("$deliveryDate +1 day")); } echo $deliveryDate;
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
16-05-2018 18-05-2018 20-05-2018
Output for 7.4.0 - 7.4.33
Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /in/5RcEZ on line 5 16-05-2018 18-05-2018 20-05-2018

preferences:
156.79 ms | 401 KiB | 187 Q