The whole problem is for a chat.
I have a echo
, within a foreach
, and for each message, get the complete date:
Example:
Sat, 21 of July 2018
and I want to know how to put a check to see if the following message has the same publication date and if it has the same date, do not print it
I want to achieve something WhatsApp , that the date is not printed again, if the message was written on the same day.
My code:
foreach($requests as &$req) {
$val1 = date('D\, j \of F Y', $req['upTime']); // da formato como el ejemplo
$b = date('D', $req['upTime']); // de la misma fecha saca el día
if ($val1 != $b){ // mira si no es la misma fecha
echo "<div class='datee'><span class='date'>".$az."</span></div>";
}
$qg = date('H:i',$req['upTime']); // la fecha del mensaje en minutos y segundos