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.4k Golang : Intercept and process UNIX signals example
+6.7k Golang : How to determine if request or crawl is from Google robots
+17.6k Golang : Find smallest number in array
+16.6k Golang : File path independent of Operating System
+19.4k Golang : Display list of time zones with GMT
+17.1k Golang : Set up source IP address before making HTTP request
+30.6k Get client IP Address in Go
+9.9k Golang : Qt get screen resolution and display on center example
+5.5k Gogland : Datasource explorer
+22.3k Golang : How to run Golang application such as web server in the background or as daemon?
+7k Mac OSX : Find large files by size
+6.3k Apt-get to install and uninstall Golang