robert_gsfame Posted July 23, 2010 Share Posted July 23, 2010 <?php $id=urldecode(base64_decode($_GET['product_id'])); $explode=explode(";",$id); $count=count($explode); for($i=0;$i<$count;$i++) { if(in_array(base64_encode($explode[$i]),$_SESSION['basket'])) { $x=""; $x=array_search(base64_encode($explode[$i]),$_SESSION['basket']); unset($_SESSION['basket'][$x]); } } ?> The problem is let say i have 3 records and unset() 2 of them, i will still have 1 record but i dont know which part is wrong, i got it not as a first index of an array which is $_SESSION['basket'][0] but $_SESSION['basket'][1] i found $_SESSION['basket'][0] empty thanks Link to comment https://forums.phpfreaks.com/topic/208631-remove-empty-element-of-session-array/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.