Skip to content
PHP Logo

What is a common issue when trying to concatenate large numbers in PHP?

When trying to concatenate large numbers in PHP, a common issue is that PHP may convert the numbers to scientific notation, which can result in loss of precision. To solve this issue, you can use the `bcadd` function in PHP, which is specifically designed for arbitrary precision arithmetic.

php
$number1 = '12345678901234567890';
$number2 = '98765432109876543210';

$result = bcadd($number1, $number2);

echo $result;