Consider that there are two moments in time, represented in the standard format (HH: mm: ss).
And consider that a point of interest is any time that is represented by at most two different digits (eg: 12:12:11 or 15:15:51)
If I wanted to go from one moment to the next telling the points of interest that exist between them, how would I implement this in PHP?
I thought of nesting three loops for one to count the hours, one to count the minutes and another to count the seconds.
Ex:
$S = '12:12:00';
$T = '12:12:15';
$arrS = explode(':', $S);
$arrT = explode(':', $T);
//Horas do primeiro momento.
$Sh = $arrS[0];
//Minutos do primeiro momento.
$Sm = $arrS[1];
//Segundos do primeiro momento.
$Ss = $arrS[2];
//Horas do segundo momento.
$Th = $arrT[0];
//Minutos do segundo momento.
$Tm = $arrT[1];
//Segundos do segundo momento.
$Ts = $arrT[2];
for($i = $Sh; $i <= $Th; $i++){
//Conta as horas
for($j = $Sm; $j <= $Tm; $j++){
//Conta os minutos
for($k = $Ss; $k <= $Ts; $k++){
//Conta os segundos
}
}
}
But I confess that from here I do not know what else to do: /
Does anyone have any ideas?