Trying to run this code on a local dev site.

$minutes_gcd = gcd($minutes, 60);

but I am only seeing this

Fatal error: Call to undefined function gcd() in C:\AcquiaSites\sites\all\modules\custom\d7dev\d7dev.module on line 31

Other PHP built in functions seem to work fine.
Is there something missing from the php.ini file possibly?

Comments

N1ghteyes’s picture

http://www.php.net/manual/en/gmp.installation.php

you may need to install the extention on your server, or ask your hosts to do it

john_b’s picture

It is not a built in function as far as I can see though this is: http://php.net/manual/en/function.gmp-gcd.php there is an example of defining it here http://php.net/manual/en/ref.math.php

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

N1ghteyes’s picture

Have a look at the installation page i linked, it lists what should be in php.ini if its there by default, if not, you can use that link to download and install it.

druvani’s picture

Try to replace the above line with this code
$minutes_gcd = gmp_strval(gmp_gcd($minutes, "60"));

okey_on’s picture

Thanks! This totally solved my same problem.