PHP code example of alexsabdev / odds

1. Go to this page and download the library: Download alexsabdev/odds library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alexsabdev / odds example snippets




use Alexsabdev\Odds\DecimalOdd;
...

$odd = new DecimalOdd(3.5);

/**
* Prints '3.5'
*/
$decimal = $odd->value();
print_r($decimal);

/**
* Prints '5/2'
*/
$fractional = $odd->toFractional()->value();
print_r($fractional);

/**
* Prints '+250'
*/
$moneyline = $odd->toMoneyline()->value();
print_r($moneyline);