无法删除数组php中的最后一个元素

I am trying to remove items from the list by clicking on the checkbox next to the item and then by clicking remove. Here is my code:

if(isset($_SESSION['items'])) {
$list=$_SESSION['items'];
// display the list and create the form with checkboxex

    if ((isset($_POST['RemoveItems'])) && (isset($_POST['removeFromList']))){
    $removeFromList=$_POST['removeFromList'];
    //removeFromList is a array holding checkboxes values
    for($i=0;$i<count($removeFromList);$i++)
    {
        unset($list[$removeFromList[$i]]);
        $_SESSION['items']=$list;
    }
}} else echo 'No items here';

What it does is removes all items except one. This element is the first element of the $list and no matter what i do i can't delete it.