note 31485 deleted from control-structures.while by alindeman
| From: | alindeman@php.net | Date: | Wed, 23 Apr 2003 20:38:08 +0000 |
| Subject: | note 31485 deleted from control-structures.while by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-46994@lists.php.net to get a copy of this message | ||
PLEASE remember to include your ending } when doing multiple statements inside a while loop. It can
lead to boggling errors like this one:
Parse error: parse error, unexpected $ in /somedir/somefile.php on line 123
where line 123 is the last line in your script.
Caused by the missing } in a piece of code like this:
if (is_dir($upload_directory)) {
if ($dh = opendir($upload_directory)) {
while ($file = readdir($dh)) {
if ($file != "." && $file != "..") {
$files[] = $file;
}
closedir($dh);
}
}
This was burried in a function with several other functions after it and weeding something like that
out is a bugger. Stick with your indentation scheme too. But if you are experiencing weird end of
script errors, then check your while statements!