PHP code example of jsgm / odds-php

1. Go to this page and download the library: Download jsgm/odds-php 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/ */

    

jsgm / odds-php example snippets


// Converting decimal to fractional.
$odd = new  Odds();
echo  $odd->set('decimal', 5.50)->get('fractional'); // "string" 9/2

// Converting fractionalto moneyline.
$odd = new  Odds();
echo  $odd->set('fractional', '11/25')->get('moneyline'); // "float" -227

// Converting fractional to implied probability.
$odd = new  Odds();
echo  $odd->set('fractional', '44/100')->get('implied'); // "string" 69.44

print $odd->set('fractional', '44/100')->reduce(); // "string" 11/25
print $odd->set('fractional', '44/100')->get('fractional'); // "string" 11/25

$odd = new Odds();
$odd->set_precision(1);
$odd->set('decimal', 1.29)->get('decimal'); // "float" 1.3


$odd->set_precision(2);
$odd->set('decimal', '1,800.00')->get('decimal'); // "float" 1800.00

$group = [['decimal', 4.45], ['decimal', 3.40], ['decimal', 1.90]];

// Use the 'Payouts' class and don't forget to 

print  $payout->get_payout(); // "float" 95.49

// 100 / (decimal odd) = implied probability
var_dump($payout->get_implied_probabilities()); // [22.47, 29.41, 52.63]

// array_sum([22.47, 29.41, 52.63]) = 104.51
// 104.51 - 100 = Overround
print  array_sum($payout->get_implied_probabilities()); // "float" 104.51
print  $payout->get_overround(); // "float" 4.51

// Formula: 100 / [Odd * (Payout / 100)] = real probability
$payout->get_real_probabilities(); // [23.53, 30.8, 55.12]

// The 'Payouts' class has to be al', 2.3], ['decimal', 3.3], ['decimal', 3.97]]);
if($surebet->is_surebet()){
	print 'Surebet found! :)';
	// '.($surebet->profit()).'% profit!';
}else{
	print 'Sorry! :( No surebet found!';
}
bash
composer 
bash
git clone https://github.com/jsgm/odds-php.git