I need help with PHP7.1 syntax errors

php

#1

Hi could anyone plaease tell mwhy the code below is giveng me this error:

PHP Parse error: syntax error, unexpected ';', expecting '(' in /pages/index.php on line 21
Errors parsing /pages/index.php

<?php foreach($pages as $page): ?>
    <p><?php echo $page["title"] ; ?></p>
<?php foreach; ?>

This is really annoying as I am following a guide and the code is identical to mine, I can only assume its related to me using PHP7.1 and the guide using an older version? Any help is much appreciated.


#2

Should this be, endforeach?


#4

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