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
+17.4k Golang : Secure(TLS) connection between server and client
+11.2k Golang : error parsing regexp: invalid or unsupported Perl syntax
+12.1k Golang : Get all local users and print out their home directory, description and group id
+8.9k Linux : How to install driver for 600Mbps Dual Band Wifi USB Adapter
+4.3k Unix/Linux : Get reboot history or check when was the last reboot date
+12.9k Golang : Missing Bazaar command
+5.9k Golang : Shuffle strings array
+3.5k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version
+9k Golang : GTK Input dialog box examples
+5.2k Golang : Output or print out JSON stream/encoded data
+9.7k Golang : Print UTF-8 fonts on image example
+11.5k Golang : How to determine if user agent is a mobile device example