PHP course is tedious to follow. Can I change settings, perhaps?


I'm going through the PHP learning exercises, and finding it quite frustrating.

For almost every exercise, I am asked to complete some action. However, the software doesn't wait till the exercise is submitted before criticizing it - it is evaluating it continuously, so before it is completed, I am told "there is a parse error", or "a syntax error", because I haven't finished the action yet. As a simple example, it says there should be a semi-colon on the end of a statement - because I haven't finished writing it. I put the semi-colon on, but the software has already decided the semi-colon is missing, and can't change its mind. I complete the exercise by writing the next couple of lines, but the software is still hassling over the missing semi-colon, so in order to progress beyond that point, I have to highlight and copy my completed code, hit the "codecademy at the top, on the new screen., press "Continue", which takes me back to my exercise screen, which shows everything down to where there should have been a semi-colon, and nothing after it - the other couple of lines aren't there. I highlight the block of code from <?PHP down to ?> and replace it by pasting my copied code, then finally, it recognises that it's OK and lets me progress.

The course is good - if somewhat pedantic - and I'm grateful for having it, but progression could certainly be a lot less tedious than it is.

When I say it is pedantic, that's because when it asks for "This is my first attempt!", it won't accept "This is my first attempt." It's supposed to be teaching programming, not the ability to exactly copy the minutiae. Another thing that has stumped me a couple of times is the use of curly braces. As an experienced C programmer, I know that they are not required where there is a single statement between them, and in that case, I leave them out without thinking. The continuous evaluation shows that the output of the exercise is what is required - they aren't required in PHP either - but when I press Submit, it is not accepted, and I'm back into copy/reset/paste.


Replace this line with your code.


I've just spent 20 minutes trying to satisfy the code that interprets the lessons. I had to print a single letter of my name. I used $alphabet as my name, and filled it with all the letters. It didn't work immediately, so to debug it a little bit, I wrote

print $alphabet; // expected "abcdefghijklmnopqrstuvwxyz";
print substr($alphabet, rand(26), 1); // expected a single, random letter (and got one)
print substr($alphabet, rand(strlen($alphabet), 1)); // another single random letter

To prevent it from printing everything on a single line, I put some

tags in - but it wouldn't accept those, though they were not syntactically incorrect.
The error I was getting was "Only one character from your name expected" (or something to that effect).
That was puzzling because I was only getting a single letter.
It took a while to realise that it was looking at the first print(), which was the whole alphabet, and thinking "This is more than a single character". The script finally worked when I took the first two lines out of it.

This course would be so much more pleasant to follow if it would simply scan to see that the necessary reserved words were in there (rand, strlen, substr), and the code produced was syntactical, and ran.


Yet another one ...

$class = array();
array_push($class, "Joe bloggs");
array_push($class, "Mary Dawk");
array_push($class, "John Doe");
array_push($class, "Killer McGee");
array_push($class, "Adolph Hitler");
print "Number " . count($class);

The output screen :
Number 5 

The comment that prevents me from moving on :
Oops, try again. The printed output should be an integer. 

Is 5 not an integer?

I don't think I have completed a single page yet without coming up against some irrelevant problem to solve before it would let me proceed.



We can disable the auto-refresh by introducing a deliberate error

<?php else ?>

Place this above your working code and remove it when ready to submit. Paste into the next lesson, It's especially useful when the lesson contains loops.


Thanks for the hint, but there's more to it than just the syntax checking. As seen in the example above, the syntax was correct, and checked out correct, but it was hassling because I had output "Number 5" instead of "5". However, the cryptic comment gives the impression there was something wrong with the program, but it was correct and giving the right output. I had others fail because there was a missing exclamation point inside a string - a punctuation that had nothing at all to do with whether I had succeeded with the PROGRAM or not. This software seems designed to frustrate.

I have found this course so disagreeable that I have moved on and looked for a different one.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.