How can custom functions be utilized in PHP to check for multiple classes in the body tag?

To check for multiple classes in the body tag using custom functions in PHP, you can create a function that takes an array of class names as input and then checks if each class exists in the body tag. This can be achieved by using the `strpos` function to search for each class name within the body tag's class attribute.

function checkBodyClasses($classes) {
    $body_classes = 'class="example-class1 example-class2 example-class3"'; // example body tag with classes
    foreach ($classes as $class) {
        if (strpos($body_classes, $class) === false) {
            return false;
        }
    }
    return true;
}

// Usage
$classes_to_check = ['example-class1', 'example-class2'];
if (checkBodyClasses($classes_to_check)) {
    echo 'All classes found in body tag.';
} else {
    echo 'Not all classes found in body tag.';
}