Web Analytics Made Easy -
StatCounter simple example I dont understand: - CodingForum

Announcement

Collapse
No announcement yet.

simple example I dont understand:

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • simple example I dont understand:

    Code:
    <?php
       
       $months = array("January", "February", "March", "April", "May");
       
       $a = 0;
       
       $b = count($months); 
       
       while($a < $b) {
          echo $months[$a], "<br />";
          ++$a;
       }
    ?>
    Elements in the array are assigned a number 0, 1, 2 etc... I did not think about that. I think I get it now. Thank you.
    Last edited by joliett89; Aug 23, 2011, 02:58 PM. Reason: It would be good if I could erase the topic all together. Not sure if I can. Thank you.

  • #2
    A simpler way of looking at/doing it (IMO):

    PHP Code:
    $months = array("January""February""March""April""May");

    foreach (
    $months as $month) {
        print 
    $month '<br /';

    Dave .... HostMonster for all of your hosting needs

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎