I have two variables:
$qty = 7;
$_POST['qty'] = 6;
var_dump($qty, $_POST['qty']); // both vars are integers
$_SESSION['qty'] = $qty + $_POST['qty'];
echo '='.$_SESSION['qty'];
This returns:
int(7) int(6) =1
(int)$qty, (int)$_POST['qty']
doesn't solve the problem.
What am I doing wrong?
Update:
... intval($qty) + intval($_POST['qty']);
not help.
And I notice one more detail. Problem apeear only when $_SESSION['qty'] >= 10:
$_SESSION['qty'] = $qty + $_POST['qty']; // $qty = 3, $_POST['qty'] = 6
Return good result ($_SESSION['qty'] = 9).
SOLVED
Thanks all for your unswers. But problem more not actual (it was a server problem). Anyway +1 to all.