i need convert Numeric representation of the day of the week to textual representation of the day of the week.
ex - 0 - sunday, 1 - monday
date('w') -> date('l');
I can do it using simple array like this.
$date = 1;
$dates = array(
0 => 'sunday',
1 => 'monday',
2 => 'tuesday',
3 => 'wednesday',
4 => 'thursday',
5 => 'friday',
6 => 'saturday',
);
echo $dates[$date]; //monday
But i need to know is this best way? How can i do it using php library function?
Improve the question.
I just find code like this.
echo date('l', strtotime(date('w')); //this code should invalid.