View Full Version : How to use gmp functions in PHP code properly
10-05-2012, 04:26 PM
I am trying to use some gmp functions (such as: gmp_clrbit(), gmp_cmp(), etc) in my PHP code. But when I run them into my server it show me a fatal error. My server supports the latest version of PHP. I can't understand what is the problem. How can I fix it?
10-05-2012, 04:40 PM
I guess this all depends on what your fatal error is.
gmp_clrbit simply sets a bit to 0.
$num = gmp_init("0x485");
print gmp_strval($num); // 0x481
cmp function would be similar, except you would give it two gmp_init variables to compare against. It will always return 0, < 0, or > 0 depending on if the "left" (first) is larger or smaller than the "right" (second).
If I had to guess though, your error is probably undefined function for gmp_init (which means you now have to install the gmp extension: http://php.ca/manual/en/gmp.setup.php)
10-10-2012, 03:11 AM
OK, thank you for your important information.
10-10-2012, 12:00 PM
This post has just saved me a lot of time :)
10-16-2012, 09:11 AM
Oh, that's a good news Acequotes. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.