For Loops Parse error


Here the Instruction
Write a for loop that counts up by 10, all the way to 100 (e.g. 10, 20, 30...). Inside the for loop, echo the current value of $i, just like in the examples above.
Here is my Solution:
for ($i = 0; $i < 101; $i+10) {
echo $i;
Here is the error I am always having:
Parse error: syntax error, unexpected ';', expecting ')' on line 10. "The program took too long to finish. Check your code for infinite loops and try again."
Some should please help to tell me where the problem is coming from


    for ($i = 0; $i < 101; $i += 10) {



Thanks, it worked out. But while must i Put = after the + sign?


This is actually a shorthand:

$i += 10

is equivalent to

$i = $i + 10

So you set $i equal to the last value of $i + 10. In other words, you are incrementing $i by 10.


Because it is augmentative. The 10 augments the existing value by the operation applied, addition. This operator applies to other maths as well.


I may be a little anal on this, but to me, increment means by one, upward and decrement, alternately, by one, downward. Am I a bit too dialed in on this definition?


I think it just means adding to in general (definition). To me it just sounds that way, but it might be different in some areas :smile:


PHP Functions Part 1

May you also help resolve this. I want to print out the number letter s has appeared in name 'apollos'. I have succeeded but yet I am have this error "Oops, try again.
Your first strpos() call should output a number."
Here is my code:
strpos('apollos', 's');
print strpos('apollos', 's');
if(strpos('apollos', 's')=== false){
echo 'There is no letter s in your name';


There are two parts to this exercise, each set up for us...

    // Print out the position of a letter that is in
    // your own name


    // Check for a false value of a letter that is not
    // in your own name and print out an error message

In this case, it doesn't hurt to leave the comments in the code for future reference. This line,

Is not doing anything so may be removed.

It also doesn't hurt if we elaborate a little so things are more spelled out:

    $myName = " ... ";
    $myS = strpos($myName, "s");
    print $myS;

I don't see anything overtly wrong in your code. One last thing I would consider is leaving white space around operators and keywords:

    if (strpos($myName, 'h') === false) {
        echo "There is no letter 'h' in your name";