|
|
|
|
|
The Greatest Common Denominator of two large numbers, using BCMath functions.
Please read the PHP manual for BCMath requirements.
It works even for those who cannot have GMP support in their PHP distribution,
for instance due to the web host policy.
You can see a demo here:
http://freephpcalculator.tk/
License: free to do whatever you want with the code even using it.
| <?php
function bcgcd ($value1, $value2) {
if ($value1 < $value2)
// Swap $value1 and $value2
{
$temp = $value1;
$value1 = $value2;
$value2 = $temp;
}
// We use the Euclid's algorithm
// for finding the Greatest Common Denominator (GCD)
$mod = 1;
while ($mod != 0)
{
$mod = bcmod ($value1, $value2);
$value1 = $value2;
$value2 = $mod;
}
return $value1;
}
?> | | |
|
| Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | A Simple Script that converts IP addresses to Color Codes -This function converts a given IP into a hex color. It changes according to ip input. Very useful to create customised pages. Categories : PHP, BC math | | | bcadd -- Add two arbitrary precision numbers Categories : PHP, PHP Functions, BC math | | | Arbitrary Precision Math using BCMATH routines Categories : PHP, Math., BC math | | | Fast PI calculator. Can easily find the 1000th decimal place of pi in 5 seconds. Categories : PHP, BC math, Algorithms | | | calculus of the eastersunday Categories : BC math, PHP, Date Time, Databases | | | How to implement a session tracking system. Categories : PHP, Sessions, Variables | | | Problem with Database Connectivity in PHP and MS Access? Don't
worry, The easy way is...... Categories : ADO, PHP, Databases | | | STR - a Perl-like string manipulator class - The str class provides 4 perl-like methods for manipulating strings and
other scalar variables. Categories : PHP, PHP Classes, Perl, Strings | | | Popup window creator for images on the Fly. Categories : PHP, GD image library, Java Script | | | PHP based Contact email form with multiple recipients, text file based, supports departments. Categories : PHP, Email, Beginner Guides, Filesystem | | | SubmitForce URL power submitter (searchengine submission class) Categories : PHP, Search Engines, URLs, PHP Classes | | | usercounter class Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables | | | Functions to access a NNTP/NNRP newsserver. Complete set with examples is at ftp://ftp.nederland.net/pub/nnrplib Categories : Search, PHP, Complete Programs | | | Script to check values being submitted by POST or GET method from a form. This script may help diagnose what variables are being supplied by a browser to other php scripts. Categories : HTML, Variables, Debugging, PHP, HTTP | |
| |
| |
|