# Fatal error: Uncaught TypeError: Unsupported operand types: string + int

**Code:** `Unsupported operand types` · **Category:** PHP · **Seen on:** PHP

An arithmetic or array operator was used with incompatible types (PHP 8 is stricter than PHP 7).

## Meaning

PHP 8 throws for operations like array + int or string + array. Non-numeric strings in arithmetic throw “Unsupported operand types” or warn “A non-numeric value encountered”.

## Common causes

- Array used in arithmetic
- null/empty array where a number was expected
- Non-numeric strings from input

## Quick fix

1. Cast and validate numbers: `(float) $price`
2. Check variables are numbers before arithmetic
3. Use array_sum() for arrays

## Detailed fix by platform

### PHP

1. `$total = array_sum(array_map('floatval', $prices));`

## How to diagnose

1. **Operands** — What are the two types?
2. **Source** — Where does the non-number come from?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/php/unsupported-operand-types)
