stumped: Unsupported operand types

This one has me pulling my hair out. I get the message “Fatal error: Unsupported operand types in /homepages/… on line 60”

Line 60 reads:

$tiles_r[$r][$c][‘green’] = round(($tiles_r[$r][$c + 1][‘green’] - $tiles_r[$r][$c - 1]) / 1.6180339887,0) + $tiles_r[$r][$c - 1][‘green’];

It is part of an if/else statement that includes the following line which occurs BEFORE line 60 and which does NOT throw an error:

$tiles_r[$r][$c][‘green’] = round(($tiles_r[$r][$c - 1][‘green’] - $tiles_r[$r][$c + 1]) / 1.6180339887,0) + $tiles_r[$r][$c + 1][‘green’];

The look identical except for the +/- signs being switched around. Can someone make sense of this?

Try echoing the variables before your equation:
$tiles_r[$r][$c + 1][‘green’]
$tiles_r[$r][$c - 1]
$tiles_r[$r][$c - 1][‘green’]

I suspect a non-numeric variable is causing the error.

Sponsor our Newsletter | Privacy Policy | Terms of Service