Parse error: syntax error, unexpected '{' in [closed]
This is my current code:
$directory = "polls/";
$dir = opendir($directory);
while (($file = readdir($dir)) !== false {
$filename = $directory . $file;
$type = filetype($filename);
if ($type == 'file') {
$contents = file_get_contents($filename);
$items = explode('¬', $contents);
echo '<table width="500" border="1" cellpadding="4">';
foreach ($items as $item) {
echo "<tr><td>$item</td></tr>\n";
}
echo '</table>';
}
}
closedir($dir);
For some reason this line is giving me an error:
while (($file = readdir($dir)) !== false {
Parse error: syntax error, unexpected '{' in
Balance your parentheses:
while (($file = readdir($dir)) !== false) {
it should be
while (($file = readdir($dir)) !== false) {
精彩评论