Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Basics (Retired) PHP Conditionals & Loops For Loops

Seth Warner
Seth Warner
5,348 Points

So why is he typing <li>. I know what it is but wouldn't it print 11 22 33 44 55 66, etc since he is adding a list?

I don't have a solid understanding why it is not print 1.1 2.2 3.4 like a normal list with strings so like 1. hi 2. bill 3. cat...just like a list, and the counter ( being increased increments) instead of words.

3 Answers

I think you're thinking of an ordered list - where the list items are prefixed by numbers by default.

<ol>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
</ol>

Will create something like this

  1. Item 1
  2. Item 2
  3. Item 3

Using an <ol> or <ul> with list-style-type: none; will hide the leading character - but you can also set numbers on <ul> and discs on <ol> by playing setting the characters using list-style-type.

Seth Warner
Seth Warner
5,348 Points

Oh your right..then why isn't there bullets?

Kevin Korte
Kevin Korte
28,149 Points

There is some css styling on the page that probably has list-item-style: none would be my guess.

Seth Warner
Seth Warner
5,348 Points

thanx kevin! I took html and CSS on codecadmey so I can see where ur coming from, that had me puzzled. So could you just not type the unordered list and list and just type $counter there and have it show its numbers? If not would you have to var_dump it?

Seth

Kevin Korte
Kevin Korte
28,149 Points

You could do

<?php
echo $counter;

and you would get 0123456789

or you could

<?php
var_dump($counter);

and you would get int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9)

Seth Warner
Seth Warner
5,348 Points

Awesome! That's what I was guessing would be the other option.

Kevin Korte
Kevin Korte
28,149 Points

You can do whatever you pretty much want to (that's valid) inside of the loop. Just whatever is in the loop will be executed each time the loop goes.