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
+9.6k Golang : Fix go.exe is not compatible with the version of Windows you're running
+15.6k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+28.3k Golang : Login(Authenticate) with Facebook example
+15.5k Golang : File path independent of Operating System
+3.6k Linux/MacOSX : Search and delete files by extension
+13.2k Golang : ROT47 (Caesar cipher by 47 characters) example
+15k Golang : Find out mime type from bytes in buffer
+21.8k Golang : Gorilla mux routing example
+6.3k Golang : How to handle file size larger than available memory panic issue
+44.2k Golang : Read tab delimited file with encoding/csv package
+9.1k Android Studio : Simple input textbox and intercept key example