Possible Duplicate:
unexpected T_FUNCTION with php 5.2.17 but fine on localhost and php 5.3.10
I’m not really used to programming in PHP and it’s my first time using an API, so this is how I’m calling it (copy/pasted from their wiki)
spl_autoload_register(function($class) {
$dir = __DIR__ .'/lib/';
$file = $dir . strtr($class, '\\', '/') . '.php';
if (file_exists($file)) {
require $file;
return true;
}
});
use WowApi\Client;
When I’m working on localhost on my own computer, everything works perfectly I’ve got no warning, no error, it works fine. The problem is when I upload this on my FTP I’ve got the following error:
Parse error: syntax error, unexpected T_FUNCTION, expecting ')'
Which refers to this line:
spl_autoload_register(function($class) {
I was told to write this in my .htaccess:
suPHP_ConfigPath /home/MYUSERNAME/public_html/php.ini
and this in my php.ini
safe_mode = OFF
But unfortunatly nothing works, I still got an error. Do you guys have an idea on how to fix this? Thanks in advance!
Anonymous function comes from php 5.3, check the php version of your server. If it is below 5.3, you need to define the function first.