When a compiler tells you it got an unexpected something, that really means right before that something something is lacking.
As the documentation
] clearly shows, in PHP foreach requires parentheses.
You probably need to pay more attention to documentation or examples, the next likely problem you'll have is endforeach does not exist as a keyword. You're too creative!