Nested blocks of the same control structure with Alternative Syntax in PHP?
following snippet generates
syntax error, unexpected 'endforeach' (T_ENDFOREACH)
for the last line.
<?php foreach($search_results as $book): ?>
<tr>
<td><?php echo $book['title']?></td>
<td>
<?php foreach($book["authors"] as $author)?>
<?php echo $author . ', '; ?>
<?php endforeach; ?>
</td>
</tr>
<?php endforeach; ?>
I had the same problem with nested if structures but don’t have any problem with nested blocks that aren’t the same.
you forgot
:in second foreach statement