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

Description

PHP accepts one star *, for multiplication and two stars **, for power, since PHP 7.0. More stars are not supported as operator.

Example

<?php

// star cannot be used directly after a +
$a = 2 + * 3;

// No such operator as 3 stars
$a = 2 *** 3;

?>

Alternatives

  • Remove the previous operator, before the star.
  • Finish the previous operation, before the star.
  • Remove the superfluous star.