What potential pitfalls should be considered when using the func_get_arg() function in PHP?

When using the func_get_arg() function in PHP, one potential pitfall to consider is that it can make the code less readable and harder to maintain, especially when the number of arguments passed to the function is not fixed. To solve this issue, consider using named arguments or passing an array as a single argument instead.

function exampleFunction() {
    $args = func_get_args();
    
    // Using named arguments
    $arg1 = $args['arg1'] ?? null;
    $arg2 = $args['arg2'] ?? null;
    
    // Or passing an array as a single argument
    $args = $args[0] ?? [];
    
    // Rest of the function logic
}