PHP : Convert(cast) bigInt to string
Problem :
In PHP, you want to convert(cast) a big integer value to string for display.
Solution :
Use GNU Multiple Precision's gmp_strval() function to convert the big integer value to string.
For example :
<?php
$bigInt = gmp_init("123456789123456789");
$bigIntStr = gmp_strval($bigInt);
echo $bigIntStr."\n";
?>
Notes :
See http://php.net/manual/en/gmp.installation.php on how to get GMP installed on your server.
Reference :
See also : PHP : Convert(cast) string to bigInt
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+11.3k Golang : Characters limiter example
+10.7k Golang : Get currencies exchange rates example
+30.4k Golang : How to redirect to new page with net/http?
+33k Golang : How to check if a date is within certain range?
+5k Golang : Constant and variable names in native language
+22.7k Golang : Strings to lowercase and uppercase example
+21.1k Golang : Convert(cast) string to rune and back to string example
+9.7k Golang : Qt get screen resolution and display on center example
+7.1k Golang : Get environment variable
+7.5k Gogland : Single File versus Go Application Run Configurations
+10k CodeIgniter : Load different view for mobile devices
+6.8k Swift : substringWithRange() function example