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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

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

Post 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.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

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

Post 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.
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

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

Post 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?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

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

Post by Christopher »

Search around to see of someone has written a PHP version of the bcmath library. You could check phpclasses.org.
(#10850)
Post Reply