There is another problem that may occur and it is worth for anyone to know it. If you use __autoload() and in the file that holds the class being autoloaded you write your PHP tags incorrectly, it will return a class not found error:
File App.php
<?
class App extends something
{
function __construct()
{
}
}
?>
file index.php
<?php
function __autoload($classname) {
$filename = "./classes/". $classname .".php";
print("Loading $filename<br>\n");
include_once($filename);
}
$app = new App();
?>
The above code does not work. For it to work you need to replace the short opening PHP tag App.php with a long one:
<?php
class App extends something
{
function __construct()
{
}
}
?>
There are many comments that could be made about short tags, the version of PHP used, the php.ini file and the rest of it. But it is irrelevant. Just use the long version of the PHP tag