Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Oct 2012
    Location
    Chittagong
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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)

  • #3
    New to the CF scene
    Join Date
    Oct 2012
    Location
    Chittagong
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK, thank you for your important information.

  • #4
    New to the CF scene
    Join Date
    Oct 2012
    Location
    US
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This post has just saved me a lot of time

  • #5
    New to the CF scene
    Join Date
    Oct 2012
    Location
    Chittagong
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh, that's a good news Acequotes.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •