Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

syntax error, unexpected token “exit”

Description

This error reports a badly placed exit or die command. Both of them are represented with the same exit token, hence the naming of the error.

Example

<?php

$a = 1
die();

?>

Alternatives

  • Make sure the previous instruction is complete, with its semi-colon.