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
+5.9k Golang : Decode XML data from RSS feed
+6.3k Golang : Of hash table and hash map
+16.6k Golang : Aligning strings to right, left and center with fill example
+11.4k Golang : Covert map/slice/array to JSON or XML format
+37.7k Golang : How to read CSV file
+7.7k Android Studio : Indicate progression with ProgressBar example
+9.9k Golang : Natural string sorting example
+4.8k Golang : Use NLP to get sentences for each paragraph example
+16.5k Golang : Upload/Receive file progress indicator
+27.3k Golang : Detect (OS) Operating System
+24.7k Mac/Linux and Golang : Fix bind: address already in use error
+28.3k Golang : Login(Authenticate) with Facebook example