What are the potential benefits and drawbacks of using anonymous functions in PHP for one-time code execution?

When you need to execute code only once and do not want to define a separate function, using anonymous functions in PHP can be a convenient solution. Anonymous functions are defined inline and can be immediately invoked, making them suitable for one-time code execution. However, they may make the code less readable and harder to maintain compared to defining a named function.

// Using an anonymous function for one-time code execution
(function() {
    // Code to be executed only once
})();