Wednesday, 2 October 2013

Remove session index php

Remove session index php

New to php
I want to remove index with value from php session array. I'm using this code
$max=count($_SESSION['Item']);
for($i=0;$i<$max;$i++){
if(strpos($_SESSION['Item'][$i]['Name'],'Shipping')!== false)
{
unset($_SESSION['Item'][$i]);
break;
}
its working fine if value exists in last index of array. But if it exists
in between. it doesn't work at all. Where am i going wrong?

No comments:

Post a Comment