0

I have this code in a file named server.class.php:

class server
{

function addPlayer($player)
    {
      //Stuff
    }
}

Then, I have this in a file called send.php. These are lines 38-40:

require('/var/www/server/apply/server.class.php');
$server = new server;
$server->addPlayer($_POST['IGN']);

However, I get this error when I visit my page (Php.ini is set to show all errors):

Fatal error: Class 'server' not found in /var/www/server/apply/send.php on line 39

Line 39 is $server = new server;

What am I doing wrong? I have verified that the class file is in /var/www/server/apply/server.class.php.

Jon
  • 2,566
  • 6
  • 32
  • 52

1 Answers1

0

$server = new server()

Missed the brackets

  • 3
    http://stackoverflow.com/questions/1945989/php-class-instantiation-to-use-or-not-to-use-the-parentheses :D – Dave Chen Jan 15 '14 at 03:26
  • *"If the constructor doesn't take any parameters I leave them out too"* --- as said in the first comment of the accepted answer in the link you provided. @DaveChen – Funk Forty Niner Jan 15 '14 at 03:29