Is there a recommended approach for organizing functions in separate files versus a centralized file in PHP development?

When organizing functions in PHP development, it is generally recommended to group related functions together in separate files for better maintainability and organization. This approach helps to keep code modular and easier to manage, especially in larger projects. However, for smaller projects or when functions are closely related, organizing them in a centralized file can be more practical.

// functions.php
include 'utils.php';
include 'math.php';
include 'string.php';

// utils.php
function formatDate($date) {
    return date('Y-m-d', strtotime($date));
}

// math.php
function add($num1, $num2) {
    return $num1 + $num2;
}

// string.php
function capitalize($str) {
    return ucfirst($str);
}