Page 1 of 1

PHP: Class not found, although file is loaded

Posted: Mon Nov 28, 2016 2:02 am
by peter_b
[PROBLEM]
Instantiating a class, gives me the following error - although the class file is loaded:
PHP Fatal error: Class 'MyClass' not found in MyClass.php on line 13
[SOLUTION]
Check if if the class name defined in its file is actually correct.

In my case, the error was similar to:

Code: Select all

class MyClasss
{
...
}
As you see, there's a typo in "MyClass.php":
The name "MyClasss" does not match "MyClass". :D