I'd like to do the same as JavaScript's .toString(16)
but in PHP :
var n = 200000002713419;
console.log(n.toString(16));
This returns b5e6211de74b
. How can I achieve the same with PHP ?
Thanks a lot.
Use PHP's built-in function base_convert()
or dechex()
:
$hex = dechex(12321313); // bc0221
$hex = base_convert(4353454654, 10, 16); // 37c723e
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.