PHP Classes

PHP Coins Change: Solve the coin change problem for a given amount

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 267 All time: 7,721 This week: 129Up
Version License PHP version Categories
coins-change 0.1GNU General Publi...5.0Algorithms, PHP 5, Finances


This class can solve the coin change problem for a given amount.

It can take a given change amount and computes the smallest number of a given set of available coins to make up the change amount.

The class may consider an infinite number of coins of each value or just a limited number of coins of each one.

Innovation Award
PHP Programming Innovation award nominee
September 2014
Number 9

Prize: One book of choice by Packt
Vending machines usually need to give change for the amount the customer paid after subtracting the due amount for the goods the customer purchased.

This class implements an algorithm to compute the number of coins to make up a given change amount, considering the number of coins available for different types of coin.

Manuel Lemos
Picture of Michele Andreoli
  Performance   Level  
Name: Michele Andreoli is available for providing paid consulting. Contact Michele Andreoli .
Classes: 7 packages by
Country: Italy Italy
Age: 37
All time rank: 54218 in Italy Italy
Week rank: 310 Up18 in Italy Italy Equal
Innovation award
Innovation award
Nominee: 4x

  Files folder image Files  
File Role Description
Plain text file CoinsManager.class.php Class Main class for coin changer
Accessible without login Plain text file index.php Example Example of use
Accessible without login HTML file output.html Output Output sample

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:7,721
This week:129Up