|
|
| Author |
Message |
Linegod Developer
Joined: 20 Feb 2003 Posts: 501 Location: Canada
|
Posted: Thu Mar 31, 2005 8:59 am Post subject: php-bcmath requires |
|
|
It would appear that the CVS version requires php-bcmath.
This is not a very common extension for at least RPM based distros. |
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Thu Mar 31, 2005 1:33 pm Post subject: |
|
|
It was implemented due to the fact that it supports the modulus function. If you know of any equivalent builtin function, please advise.
TheWitness |
|
| Back to top |
|
 |
Linegod Developer
Joined: 20 Feb 2003 Posts: 501 Location: Canada
|
Posted: Thu Mar 31, 2005 2:23 pm Post subject: |
|
|
Not built in, but provide on the the bcmod page at php.net:
| Code: |
<?php
/**
* my_bcmod - get modulus (substitute for bcmod)
* string my_bcmod ( string left_operand, int modulus )
* left_operand can be really big, but be carefull with modulus :(
* by Andrius Baranauskas and Laurynas Butkus :) Vilnius, Lithuania
**/
function my_bcmod( $x, $y )
{
// how many numbers to take at once? carefull not to exceed (int)
$take = 5;
$mod = '';
do
{
$a = (int)$mod.substr( $x, 0, $take );
$x = substr( $x, $take );
$mod = $a % $y;
}
while ( strlen($x) );
return (int)$mod;
}
// example
echo my_bcmod( "7044060001970316212900", 150 );
?>
|
|
|
| Back to top |
|
 |
|