Reputation: 1898
I have an addition operation that I am executing in both in Java and in PHP.
In Java summing up int(334420379) with int(1825406976) results in int(-2135139941). In PHP summing the same values results in double(2159827355).
How can I replicate the Java results in PHP?
Upvotes: 1
Views: 92
Reputation: 4170
you can use the intval() method in php
$v1 = 334420379;
$v2 = 1825406976;
$res = intval($v1+$v2);
it will return you the desired result
-2135139941
Upvotes: 1