Jump to content

StraightJ

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

StraightJ's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks guys. It was really buggin me all morning. I'll test when i get home from work. Thanks!
  2. Hello everyone. I am new to PHP, and to programming in general. As of right now, I am reading and learning from "Learning PHP and MySQL" by Michele E. Davis and Jon A. Phillips. In the 'for' loop section of chapter 4, the example they give that actually works, is: <?php for ($num = 1; $num <= 10; $num++) { print "Number is $num<br />\n"; } ?> A question at the end of the chapter requests that I make a 'for' loop counting from 10 to 1. I wrote it as follows: <?php for ($num = 10; $num >= 10; $num--){ print "Number is $num<br />"; } ?> For some reason, my code does not execute, but their example above does. When I checked the appendix answer for creating a 'for' loop counting from 10 to 1, this is the answer the appendix provides: <?php for ($num = 10; $num >= 1; $num&#8722;&#8722;){ print "$num<br>; } ?> For some reason, the 3rd expression in the code above is not showing up correctly, but it reads, "$num&#8722;&#8722" if that helps. I don't agree with the appendix, being that it looks radically different than the example used in the chapter, and i have no idea how to decipher the 3rd expression in the for loop. Can someone tell me what I am doing wrong?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.