|
|
|
<?
function GCD ($a, $b)
{
while ( $b != 0)
{
$remainder = $a % $b;
$a = $b;
$b = $remainder;
}
return abs ($a);
}
/*
DESCRIPTION
============================================================
GCD:
A simple function that finds the Greatest Common Denominator
for two numbers.
============================================================
CREDITS
============================================================
Author: J. A. Greant ( zak@nucleus.com )
Version 1: June 9, 2000
============================================================
NOTICES
============================================================
If you:
Modify this code and want to share your changes :)
Find a bug
Have other questions or comments
Please write:
Zak Greant (zak@nucleus.com)
============================================================
USAGE EXAMPLES
============================================================
print GCD (12, 120); // Should output 12
============================================================
COPYRIGHT
============================================================
Copyright (c) 2000 J. A. Greant ( zak@nucleus.com )
All rights reserved.
This function is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General
Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any
later version.
This function is distributed in the hope that it will be
useful,but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General
Public License along with this function; if not, write to
the:
Free Software Foundation, Inc.
59 Temple Place, Suite 330
Boston, MA
02111-1307 USA
http://www.gnu.org/
============================================================
*/
?> |
|
| Permutations, Combinations and Factorials Categories : PHP, PHP Classes, Math. | | | 3dLib - a class for drawing in 3D space. Supported functions: Line, SetPixel, Polygon, FilledPolygon, etc. 3dChart() function has been added for one-call drawing of 3d charts. Support of mostly used 3d-transformations. Categories : Graphics, Math., PHP Classes, PHP, Charts and Graphs | | | very simple ftp class Categories : PHP, PHP Classes, FTP | | | PHP Paypal IPN Integration Class v1.0.0 Categories : PHP, PHP Classes, Payment Gateways | | | A simple class with some HTML output functions that would come in handy for consistent page layout etc. Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation | | | Math operations on big numbers Categories : PHP, Math. | | | Excel class in PHP Categories : PHP, PHP Classes, Excel | | | The class to check load time of your script
VERY usefull for relatively slow applications, but not only.. Categories : PHP, PHP Classes, Debugging | | | Simple Template Class/Example Categories : PHP, Templates, PHP Classes | | | usercounter class Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables | | | RSS parser.
Parses RSS into an array. Quick and nasty but does the job.
No checking is done for correct Tags, only correct XML.
PHP4 needed to display result (uses print_r). Categories : PHP, XML, PHP Classes, Rich Site Summary (RSS) | | | Weighted Random - Random Scripts usually chose one out of each item, and each item have an equal chance to be chosen. But what if you want an item to be chosed more frequently than other? Categories : PHP, Math., Arrays | | | Very minimal templating engine Categories : PHP, PHP Classes, Templates | | | XPath for PHP without the DOM XML extension Categories : DOM XML, XML, XSLT, PHP Classes, PHP | | | These PHP Classes Check if a host is alive using various methods. Categories : PHP, PHP Classes, Sockets, CURL | |
|
|
|