example - ideone
$output ="";
$semana = array(
'1' => 'Segunda-Feira',
'2' => 'Terca-Feira',
'3' => 'Quarta-Feira',
'4' => 'Quinta-Feira',
'5' => 'Sexta-Feira',
'6' => 'Sábado',
'7' => 'Domingo'
);
$a = array_slice($semana, date('w') - 1 );
$b = array_slice($semana, 0 , date('w') - 1 );
$c = array_merge_recursive( $a , $b );
foreach( $c as $key => $value ) {
$output = $output . '<div class="dia-semana"><div class="dial">'. $value . "</div></div>" ;
}
$result = '<div class="base-semana">'.$output.'</div>' ;
echo $result;
$a = returns the sequence of all $week elements from [date('w')-1], date('w') being the numerical representation of the day of the week.
$b = returns the sequence of the elements of the $week array from zero to [date('w')-1], date('w') being the numerical representation of the day of the week.
$c = merge the $a elements with the $b array so that the $b elements are placed at the end of the $a array.
To set the result according to the time of Brasilia instead of the time of the server put this line date_default_timezone_set('America/Sao_Paulo');
at the beginning of PHP. Reference - date_default_timezone_set
Just this HTML? Have some PHP?
– user60252
It only has html, I want to do php to display what I want, you know? However there are 7 Ivs of the class "day-week" within the "base-week" put only one to decrease the post.
– Paulo Sérgio Filho