3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $correctTimestamp = correctMondayTimestamp(); $time_query = "data_ordine BETWEEN DATE('".date("Y-m-d",$correctTimestamp)."') AND DATE_ADD(DATE('".date("Y-m-d",strtotime("sunday this week"))."'), INTERVAL 1 DAY)"; $begin = new DateTime(date("c", $correctTimestamp)); echo "TQ: $time_query\nB: ".date_format('U',$begin); function correctMondayTimestamp(){ if(date('N') == 7) { return strtotime('monday last week'); } else { return strtotime('monday this week'); } }
based on 4rht3
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0beta1
Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in /in/mlUTN on line 6 TQ: data_ordine BETWEEN DATE('2017-06-19') AND DATE_ADD(DATE('2017-06-25'), INTERVAL 1 DAY) B:
Output for hhvm-3.15.4
Warning: date_format() expects parameter 1 to be object, string given in /in/mlUTN on line 6 TQ: data_ordine BETWEEN DATE('2017-06-19') AND DATE_ADD(DATE('2017-06-25'), INTERVAL 1 DAY) B: