このコード削除のケースでは、Session Get Negative value よりも多くの時間を実行します。Session get Only Positive value のコードでどのタイプの変更が発生していますか。
<?php
session_start();
$d1=$_POST['d1'];
$action=$_POST['str1'];
$product_id = $_POST['productid'];
switch($action)
{
case "Add":
$_SESSION['cart'][$product_id] = $d1 + (isset($_SESSION['cart'][$product_id]) ?$_SESSION['cart'][$product_id] : 0);
break;
case "Remove":
$_SESSION['cart'][$product_id]=(isset($_SESSION['cart'][$product_id]) ? $_SESSION['cart'][$product_id] : 0)- $d1;
if($_SESSION['cart'][$product_id] == 0)
unset($_SESSION['cart'][$product_id]);
break;
}
?>