How can the error message "Cannot redeclare class" be resolved in PHP when working with multiple class files?

When working with multiple class files in PHP, the error message "Cannot redeclare class" occurs when a class is declared more than once in different files. To resolve this issue, you can use the PHP function `class_exists()` to check if a class has already been defined before declaring it.

// Check if the class has already been declared before declaring it
if (!class_exists('ClassName')) {
    class ClassName {
        // Class code here
    }
}