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
+6.4k Golang : Experimental emojis or emoticons icons programming language
+4.8k Golang : Constant and variable names in native language
+18.4k Golang : convert int to string
+24.2k Golang : Time slice or date sort and reverse sort example
+7.5k Golang : Trim everything onward after a word
+19.7k Golang : How to get own program name during runtime ?
+5.9k Golang : Convert Chinese UTF8 characters to Pin Yin
+5.8k Golang : How to verify input is rune?
+22.3k Golang : Set and Get HTTP request headers example
+7.2k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+10.6k Golang : How to transmit update file to client by HTTP request example
+6.9k Golang : Use modern ciphers only in secure connection