[PHP] How to gmp_import or gmp_export a negative value?
- Date: Mon, 29 Feb 2016 14:14:47 +0300
- From: Andrey Repin <anrdaemon@xxxxxxxxxxx>
- Subject: [PHP] How to gmp_import or gmp_export a negative value?
I'm working with some big numbers my platform can't handle, and I need a way
to store and retrieve them reliably.
But much to my dismay, I've found that GMP is unable to handle negative
This can be demonstrated with a very short script:
$x = "\xff";
$s = gmp_export(unpack('c', $x), 1);
printf("In: %d, Out: %d\n", ord($x), ord($s));
If this an intended behavior? Or am I missing some flag to make it work the
Sincerely Yours, Andrey Repin <anrdaemon@xxxxxxxxxxx>
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php