syntax error, unexpected token “%”

Description

PHP accepts one percentage %, for modulo. The % operator requires 2 operands, one before, and one after. This is not the same as + and -, which can be used as unary operator.

Example

<?php

$a = 2 + % 3;

?>

Solutions

  • Remove the superfluous percentage.