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
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.

Link to comment
Share on other sites

You're trying to add an array to a number and wondering why it won't work? You gotta think things through before you start to code :(

 

Explain to me why you'd want to add an array to an integer.

 

What are the contents of this array?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.