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 “as”

Description

The as token was found, where it was not expected. as is often used as a modulator of another instruction: foreach, use, function.

Example

<?php

A\B as C;

?>

Alternatives

  • Add a missing use to start the instruction.