I used this function but it does not work good with very large and small numbers
function convert($number)
{
return (string)sprintf("%.40f", floatval($number));
}
//example 1
// convert(10);
//"10.0000000000000000000000000000000000000000" correct
//
//example 2
// convert(1.0464844434049273e-9)
// "0.0000000010464844434049272962108666736101" incorrect
// "0.0000000010464844434049273" correct
//
//example 3
// convert(0.0000010464844434049273)
// "0.0000010464844434049273375698973012615234" incorrect
// "0.0000010464844434049001" correct
I checked these numbers in here
is there any good package for working with these types of number in php or laravel?