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.1k Golang : Test input string for unicode example
+9.5k Golang : Turn string or text file into slice example
+48.3k Golang : Upload file from web browser to server
+8.6k Golang : Find network service name from given port and protocol
+10.4k Golang : Bubble sort example
+31.2k Golang : Example for ECDSA(Elliptic Curve Digital Signature Algorithm) package functions
+7.7k Swift : Convert (cast) String to Float
+29.5k Golang : Get and Set User-Agent examples
+7.3k Golang : Get YouTube playlist
+6.6k Fix sudo yum hang problem with no output or error messages
+8.2k Golang : Generate Datamatrix barcode