Jump to content

Can't increment/decrement overloaded objects nor string offsets


Phalanxer

Recommended Posts

I was using:

 

if ($_POST['num'] == '3') {
$_SESSION['number1']++;
}

... and everything was fine.

 

Now I am using:

if ($_POST['num'] == '3') {
$_SESSION['tablea']['number1']++;
}

... and getting:

Cannot increment/decrement overloaded objects nor string offsets

 

Does anyone know what has caused this?

In order to use an increment/decrement, the variable being incremented or decremented must exist and have a value.

 

What if you do

 

if ($_POST['num'] == '3')
{
    print_r($_SESSION['tablea']);
    $_SESSION['tablea']['number1']++;
}

 

Does that demonstrate that the key number1 exists as a member of $_SESSION['tablea']? Is $_SESSION['tablea'] an array?

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.