Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-05-2012, 04:26 PM   PM User | #1
Shondhi
New to the CF scene

 
Join Date: Oct 2012
Location: Chittagong
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Shondhi is an unknown quantity at this point
How to use gmp functions in PHP code properly

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?
Shondhi is offline   Reply With Quote
Old 10-05-2012, 04:40 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,645
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
I guess this all depends on what your fatal error is.
gmp_clrbit simply sets a bit to 0.
PHP Code:
$num gmp_init("0x485");
gmp_clrbit($num3);
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)
Fou-Lu is offline   Reply With Quote
Old 10-10-2012, 03:11 AM   PM User | #3
Shondhi
New to the CF scene

 
Join Date: Oct 2012
Location: Chittagong
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Shondhi is an unknown quantity at this point
OK, thank you for your important information.
Shondhi is offline   Reply With Quote
Old 10-10-2012, 12:00 PM   PM User | #4
Acequotes
New to the CF scene

 
Join Date: Oct 2012
Location: US
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Acequotes is an unknown quantity at this point
This post has just saved me a lot of time
Acequotes is offline   Reply With Quote
Old 10-16-2012, 09:11 AM   PM User | #5
Shondhi
New to the CF scene

 
Join Date: Oct 2012
Location: Chittagong
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Shondhi is an unknown quantity at this point
Oh, that's a good news Acequotes.
Shondhi is offline   Reply With Quote
Reply

Bookmarks

Tags
functions, gmp, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:16 PM.


Advertisement
Log in to turn off these ads.