Convert odds between american, decimal, and fractional formats
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"
}
}
require_once "../vendor/autoload.php";
$converter = new \Sharapov\OddsConverter\OddsConverter($odd);
Set up your input odd in the decimal, fractional or moneyline (US) format
$converter->setOdd('275');
print $converter->getFractional(); // 11/4
print $converter->getDecimal(); // 3.75
$converter->setOdd('11/4');
print $converter->getMoneyline(); // 275
print $converter->getDecimal(); // 3.75
$converter->setOdd('3.75');
print $converter->getMoneyline(); // 275
print $converter->getFractional(); // 11/4
That's so easy