aswathi rajasekar
asked on
php code
while using php code for each month and date .....why cant we use "if condition" or any other looping condition
ASKER
yea this is what is asked..thnq
Some background information might be helpful.
Old, procedural examples (for historical purposes only):
https://www.experts-exchange.com/articles/11271/Understanding-Client-Server-Protocols-and-Web-Applications.html
Modern object-oriented examples (what you should be learning and using today):
https://www.experts-exchange.com/articles/20920/Handling-Time-and-Date-in-PHP-and-MySQL-OOP-Version.html
Old, procedural examples (for historical purposes only):
https://www.experts-exchange.com/articles/11271/Understanding-Client-Server-Protocols-and-Web-Applications.html
Modern object-oriented examples (what you should be learning and using today):
https://www.experts-exchange.com/articles/20920/Handling-Time-and-Date-in-PHP-and-MySQL-OOP-Version.html
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
<?php
$date = new DateTime();
for($i = 0; $i < 12; $i++)
{
echo $date->format('Y-m') . "\n";
$date->modify('+1 month');
}