Displaying a List of Months with a foreach Loop in PHP


Generate a select dropdown of months using a loop.

Source Code

$months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
echo '';
foreach ($months as $month) {
    echo "$month";
}
echo '';
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments