What causes 'call to a member function on a non-object in php'?

Example:

$nonObject = null;
$nonObject->someFunction();

Attempting to call a method on something that isn't an object.

Solution:

Ensure that the variable you're trying to call the method on is properly instantiated as an object of the correct class.


$obj = new SomeClass();
$obj->someFunction();

Beginner's Guide to PHP