Jump to content

weird problem when emptying array


xiao

Recommended Posts

I create my array like this:

$_SESSION['ECpc'] = $productcodeEC;
$_SESSION['ECid'] = $rij['products_id'];
$_SESSION['ECprijs'] = $rij['products_price'];
$_SESSION['ECnaam'] = $rij['products_name'];

And add stuff to it like this:

array_push($_SESSION['ECpc'], $productcodeEC);
array_push($_SESSION['ECid'], $rij['products_id']);
array_push($_SESSION['ECprijs'], $rij['products_price']);
array_push($_SESSION['ECnaam'], $rij['products_name']);

 

And I delete from it like this:

array_splice($_SESSION['ECpc'],$id,1);
array_splice($_SESSION['ECid'],$id,1);
array_splice($_SESSION['ECprijs'],$id,1);
array_splice($_SESSION['ECnaam'],$id,1);

 

It all works fine, unless I delete $id = 0, then php always deletes $id = 0 and $id = 2...

???

 

Link to comment
https://forums.phpfreaks.com/topic/102519-weird-problem-when-emptying-array/
Share on other sites

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.