I am writing a bit of PHP to implement ELO between soccer teams. I am using the ELO class found here: https://github.com/Chovanec/elo-rating and I am not modifying that code at all.
This is something that is driving me insane, I am clearly missing something obvious but I have no idea what.
So in my PHP file: results.php I have the following:
<?php
require_once('Rating.php');
And then it goes into the code, always giving an error when it comes to me implementing the Rating class:
$r = new Rating($teamA,$teamB,1,0);
To which I get the following error:
Fatal error: Class 'Rating' not found in /home/XXXXX/public_html/soccer/results.php on line 65
So, to try and bug check I go all the way back to the top and use the following:
<?php
require_once('Rating.php');
if (class_exists('Rating')) {
echo "Found";
} else {
echo "Not found";
}
die();
To which I get "Not found"
The Rating.php file opens as follows:
<?php
/**
* This class calculates ratings based on the Elo system used in chess.
*
* @author Michal Chovanec <michalchovaneceu@gmail.com>
* @copyright Copyright © 2012 - 2014 Michal Chovanec
* @license Creative Commons Attribution 4.0 International License
*/
namespace Rating;
class Rating
{
I've confirmed the file is getting loaded correctly.
What am I missing?
Rating.php
start code (until Rating class declaration). Namespace issue?