Input will consist of many number pairs, each on a separate line and the numbers are separated by a comma. The numbers can be as big as 100 digits long. The numbers will be integer and factional numbers and negative numbers will not be in input. Input will be terminated by end of file.
The output will be the reversed sums each on an individual line of its own. For each input pair, there should be one reversed sum.
I am writing this this code but not give correct result as integer value $number="36222813552166588601325554186418874001226412488844274840066661514,32814873748120642422248240335447 "; $int_array = array_map("intval", explode(",", $number));
$sum=0;
foreach($int_array as $item)
{
$sum=$sum+strrev($item);
}
$reverse_sum=str_replace("0","",strrev($sum));
echo $reverse_sum;
Got output: 91+E562719451714.1
Expected output: 68046696201386131133563894412955974001226412488844274840066661514