Hello,
I'm having hard time with spl_autoload_register function specially when its inside a class. I would appreciate any help
This is my index.php
<?php
require('./loadclasses.php');
?>
loadclasses.php
<?php
class loadclasses
{
function autoLoader($className)
{
$fileName = str_replace("_", PATH_SEPARATOR, $className);
include($fileName);
}
spl_autoload_register('autoLoader');
}
But i keep getting this error
Parse error: syntax error, unexpected 'spl_autoload_register' (T_STRING), expecting function (T_FUNCTION) in d:\xampp\htdocs\welcomemanager\loadclasses.php on line 11
I am running php 5.4 version on xmapp
thanks again!