Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PHP Coding Project 1 Page19

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
seancyril



Joined: Sat Mar 13, 2010 12:08 pm
Posts: 18

PostPosted: Fri Jul 23, 2010 7:10 pm    Post subject: PHP Coding Project 1 Page19 Reply with quote

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
View user's profile Send private message
Ram
LXF regular


Joined: Thu Apr 07, 2005 10:44 pm
Posts: 1661
Location: Guisborough

PostPosted: Sat Jul 24, 2010 12:16 am    Post subject: Reply with quote

Your missing a closing ) in your foreach loop:

Code:
<?php
$files=scandir(".");
foreach ($files as $file) {
print "$file\n";
}

?>

_________________

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
Back to top
View user's profile Send private message MSN Messenger
seancyril



Joined: Sat Mar 13, 2010 12:08 pm
Posts: 18

PostPosted: Sat Jul 24, 2010 6:40 pm    Post subject: Reply with quote

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 user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast