| View previous topic :: View next topic |
| Author |
Message |
seancyril
Joined: Sat Mar 13, 2010 12:08 pm Posts: 18
|
Posted: Fri Jul 23, 2010 7:10 pm Post subject: PHP Coding Project 1 Page19 |
|
|
Hi, I am a total newb when it comes to programming and was really enjoying the php coding academy in this month's mag until I ground to a halt at page 19.
I have input the following to project1.php
<?php
$files=scandir(".");
foreach ($files as $file {
print "$file\n";
}
?>
When I try and run the script I get the following error message
PHP Parse error: syntax error, unexpected ';' in /home/sean/PHP/project1.php on line 4
Please can anyone advise me as to what I am doing wrong? I believe I have input exactly what was stated in the magazine. I am obviously doing something wrong so any advice would be much apprectiated
thanks
Sean |
|
| Back to top |
|
 |
Ram LXF regular

Joined: Thu Apr 07, 2005 10:44 pm Posts: 1550 Location: Guisborough
|
Posted: Sat Jul 24, 2010 12:16 am Post subject: |
|
|
Your missing a closing ) in your foreach loop:
| Code: | <?php
$files=scandir(".");
foreach ($files as $file) {
print "$file\n";
}
?> |
_________________
Ubuntu LXDE 12.04 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
|
|
| Back to top |
|
 |
seancyril
Joined: Sat Mar 13, 2010 12:08 pm Posts: 18
|
Posted: Sat Jul 24, 2010 6:40 pm Post subject: |
|
|
Of course! Thanks for that. I'm really enjoying learning about coding. I can crack on with the rest of the booklet now
Sean |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|