Jump to content

Can't unset string offsets


Phalanxer

Recommended Posts

I really don't quite understand this problem:

 

Cannot unset string offsets

 

if (isset($_SESSION['tablea']['numbers1-6'])) {
$_SESSION['tablea']['numbers1-6prior'] = $_SESSION['tablea']['numbers1-6'];
unset($_SESSION['tablea']['numbers1-6']);
}

 

The problem is with the last line - unset($_SESSION['tablea']['numbers1-6']);

 

Can someone please tell me what the problem is? I don't understand.

Link to comment
https://forums.phpfreaks.com/topic/264988-cant-unset-string-offsets/
Share on other sites

in this part no problems

$_SESSION['tablea']['numbers1-6'] = 1;
if (isset($_SESSION['tablea']['numbers1-6'])) 
{
$_SESSION['tablea']['numbers1-6prior'] = $_SESSION['tablea']['numbers1-6'];
unset($_SESSION['tablea']['numbers1-6']);
}
var_dump($_SESSION['tablea']['numbers1-6']);

Notice: Undefined index: numbers1-6 in /var/www/absolux/test/run.php on line 8

NULL

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.