php code

aswathi rajasekar
aswathi rajasekar used Ask the Experts™
while using php code for each month and date .....why cant we use "if condition" or any other looping condition
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

I don't understand your question. It might help to see an example of what you have and what you want. In the meantime, here's an example of looping through the next 12 months:

$date = new DateTime();
for($i = 0; $i < 12; $i++)
  echo $date->format('Y-m') . "\n";
  $date->modify('+1 month');


yea this is what is asked..thnq
Most Valuable Expert 2011
Top Expert 2016

Some background information might be helpful.

Old, procedural examples (for historical purposes only):

Modern object-oriented examples (what you should be learning and using today):

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial