Skip to content

Convert odds between american, decimal, and fractional formats

License

Notifications You must be signed in to change notification settings

sharapov-outsource/odds-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Odds Converter

Convert odds between american, decimal, and fractional formats

Installation

You can either get the files from GIT or you can install the library via Composer. To use Composer, simply add the following to your composer.json file.

{
    "require": {
        "sharapov/odds-converter": "1.01"
    }
}

How to use it?

require_once "../vendor/autoload.php";

$converter = new \Sharapov\OddsConverter\OddsConverter($odd);

Set up your input odd in the decimal, fractional or moneyline (US) format

Set moneyline (US) input

$converter->setOdd('275');
Get fractional
print $converter->getFractional(); // 11/4
Get decimal
print $converter->getDecimal(); // 3.75

Set fractional input

$converter->setOdd('11/4');
Get moneyline (US)
print $converter->getMoneyline(); // 275
Get decimal
print $converter->getDecimal(); // 3.75

Set decimal input

$converter->setOdd('3.75');
Get moneyline (US)
print $converter->getMoneyline(); // 275
Get fractional
print $converter->getFractional(); // 11/4

That's so easy

About

Convert odds between american, decimal, and fractional formats

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages