Unsupported operand types: %s %s %s

Description

This error is reported when the types of the operands are valid (here, int and string), but they are not compatible one another. It is possible to use the & operator with two integers, or with two strings but not with one string and one integer.

Example

<?php

1 & 'B';

?>

Literal Examples

  • Unsupported operand types: int & string

Solutions

  • Make both sides of the operator the same type.