Jump to content

Unsupported operand types error. Help.


iStriide

Recommended Posts

I am getting this error: Fatal error: Unsupported operand types.

<?php

$new_player_credits = $player_credits + $game_credits;
$new_player_exp = $player_exp + $game_exp;

?>

 

I have absolutely no clue why I'm getting the error. Both of my variables are integers.

Link to comment
https://forums.phpfreaks.com/topic/245713-unsupported-operand-types-error-help/
Share on other sites

The only time I get this error is when I try to add an array to something.

 

Even an object should return something like

Notice: Object of class classname could not be converted to int in file on line x

 

Even using a resource type leads to an error-less adding attempt.

I'm using an array and adding it to a number. How can I make it add?

 

What? You stated "Both of my variables are integers.". But, now you say you are trying to add an array to a number. I don't even know what that means. You might as well state you are trying to add the color 'blue' to a school of fish. It is illogical.

 

You can add a "value", or "values", in the array to a number. You'd better show what the contents of the array are and what your expectations when "adding" the array to the number are.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.