Page 1 of 1

function - bcadd() - get fatal error in php5, why?

Posted: Wed Feb 06, 2008 5:08 am
by crazytopu
I am just wondering if the function - bcadd() has any issue in PHP5 that I am not aware of.

I have a site running on php4 in one location and on php5 in another location.

in buyerArea.php on line 233 I have this line of code:

Code: Select all

 
// quote starts from 20001 
$quote = 'Q' . bcadd(20000, $id, 0);
 
in php4 it works fine, but in php5 I get this error:

Code: Select all

 
Fatal error: Call to undefined function: bcadd() in /web/sites/user/0/91/87476/public/www/buyerArea.php on line 233
 
I have checked the manual and it shows the function is still available in php5.

Any clue why am I getting thie error?

Many Thanks for reading my post.

Re: function - bcadd() - get fatal error in php5, why?

Posted: Wed Feb 06, 2008 8:21 am
by Zoxive
bcadd() is a part of bcmath, a built-in php library.
You need to enable it when you build/install PHP.

It is disabled by default.

Re: function - bcadd() - get fatal error in php5, why?

Posted: Wed Feb 06, 2008 8:48 am
by crazytopu
Thank you. So, is there any workaround to it so i can fix my code or do i have to ask hosting company to enable it?

Re: function - bcadd() - get fatal error in php5, why?

Posted: Wed Feb 06, 2008 11:34 am
by Christopher
Search around to see of someone has written a PHP version of the bcmath library. You could check phpclasses.org.