php - Trouble with inarray -


so i'm trying create check date , produce different variable result depending on date today.

this current code:

<?php      for($i = 0; $i <= 25; $i++)      $dates[] = date("d", strtotime( "+$i days"));     foreach ($dates $today) {         if (in_array($today, array('01', '05', '09', '14', '19', '24'), true)) {             $tweet = "one";         }         if (in_array($today, array('02', '06', '10', '15', '20', '25'), true)) {             $tweet = "two";         }         if (in_array($today, array('03', '07', '11', '16', '21'), true)) {             $tweet = "three";         }         if (in_array($today, array('04', '08', '12', '17', '22'), true)) {             $tweet = "four";         }     }     echo $tweet; ?> 

problem if date changes echos "four", missing?

because overwrite $tweet in each iteration of loop, means last iteration available. last iteration today + 25 days, 12th december.

12 causes assignment of $tweet four , since that's last iteration, that's $tweet be equal after loop ends.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -