Array as a session variable - Bug ?

From: Date: Fri, 11 Aug 2000 14:33:25 +0000
Subject: Array as a session variable - Bug ?
Groups: php.general 
Request: Send a blank email to php-general+get-11328@lists.php.net to get a copy of this message
Greetings, I'm working with php 4.0(1-08-2000 snapshot) and I use an array as an session variable.I've noticed that I can read the array only once, and at the second read the array is empty . For example $number=4; for($i=0;$i<$number;$i++){ echo $i; //ses_packs - the session array while(list(,$val)=each($ses_packs)){ pg_exec("insert into tblc(pack) values('".$val."')"); } } At the first iteration the values are inserted but at the second one the ses_packs is empty. Of course I can use an work around but I was wondering if this a normal behaviour or it's a bug. $number=4; for($i=0;$i<$number;$i++){ echo $i; //ses_packs - the session array while(list($key,$val)=each($ses_packs)){ pg_exec("insert into tblc(pack) values('".$val."')"); $aux[$key]=$val; } $ses_packs=$aux; } Any ideas ? Ovidiu

« previous php.general (#11328) next »