I want to add a new line in order to group dates within a foreach loop.
foreach
Example:
2015-11-05 2015-11-05 2015-11-07 2015-11-10 2015-11-1
One way to do this is to save the previous value and compare it to the current one:
$prev = NULL; foreach($rows AS $row) { $curr = $row['datetime_published']; echo "$curr"; if ($curr != $prev) { echo ''; $prev = $curr; } }