I'm trying to show some headers and footers to numbers, the array contains dates and what I want is that these are separated by date.
the ideal would only declare one header and one footer.
I need to do 2 foreach ?? or anyone has any idea?, thx
<?php
$datos = array(
array("date" => "2018"),
array("date" => "2016"),
array("date" => "2016"),
array("date" => "2015"),
array("date" => "2015"),
array("date" => "2015"),
array("date" => "2015"),
array("date" => "2014"),
array("date" => "2014"),
array("date" => "2005"),
);
echo "<pre>";
print_r($datos);
echo "</pre>";
echo "HEADER TOP<br>";
foreach ($datos as $row) {
if ($datos['date'] != @$lezte_jahr){
echo "FOOTER <br><br><br> HEADER ";
}
echo $row['date'] . " ";
$lezte_jahr = $row['date'];
}
echo "FOOTER TOP<br>";
?>
i like result, but i dont know how XD
--a--
2018
--b--
--a--
2016
2016
--b--
--a--
2015
2015
2015
2015
--b--
--a--
2014
2014
--b--
--a--
2005
--b--