3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_date($t, $s, $f){ return date($f,t); } $week =7*24*3600; $fix = ( intval(format_date(ceil(time()/$week)*$week,'custom', 'd')) - intval(format_date(time(),'custom','d')) )*24*3600; $sql = "select from_unixtime(ceil((created+$fix)/$week)*$week - $fix) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7"; print $sql;
Output for 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in /in/bFDqE on line 2 Warning: date() expects parameter 2 to be int, string given in /in/bFDqE on line 2 Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in /in/bFDqE on line 2 Warning: date() expects parameter 2 to be int, string given in /in/bFDqE on line 2 select from_unixtime(ceil((created+0)/604800)*604800 - 0) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7
Output for 7.2.0 - 7.2.26
Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in /in/bFDqE on line 2 Warning: date() expects parameter 2 to be integer, string given in /in/bFDqE on line 2 Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in /in/bFDqE on line 2 Warning: date() expects parameter 2 to be integer, string given in /in/bFDqE on line 2 select from_unixtime(ceil((created+0)/604800)*604800 - 0) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Notice: Use of undefined constant t - assumed 't' in /in/bFDqE on line 2 Warning: date() expects parameter 2 to be integer, string given in /in/bFDqE on line 2 Notice: Use of undefined constant t - assumed 't' in /in/bFDqE on line 2 Warning: date() expects parameter 2 to be integer, string given in /in/bFDqE on line 2 select from_unixtime(ceil((created+0)/604800)*604800 - 0) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Notice: Use of undefined constant t - assumed 't' in /in/bFDqE on line 2 Warning: date() expects parameter 2 to be long, string given in /in/bFDqE on line 2 Notice: Use of undefined constant t - assumed 't' in /in/bFDqE on line 2 Warning: date() expects parameter 2 to be long, string given in /in/bFDqE on line 2 select from_unixtime(ceil((created+0)/604800)*604800 - 0) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7

preferences:
161.37 ms | 403 KiB | 242 Q