Bir değişkeni unsetting

0 Cevap

Ben burada bazı kod wich aşağıdaki gibi görünen var:

if (isset($_SESSION['addToCart'])) {
    foreach ($_SESSION["addToCart"] as &$value){
        if ($value['titel'] == $titel){ 
            $value['aantal'] = $aantal;
            if($value['aantal'] == 0){
                unset($value);
            }
        }
    }
}

so when 'aantal' = 0, i want to delete that record, but it doesnt it just gives back the result and 'aantal' is 0 instead of the record being removed from the session. Anyone know what i'm doing wrong?

0 Cevap