Q: I am having an error on php has there been a change in the way syntax is done? I have the following code on my php website from a theme i made a long time ago but it gives warnings on 7.4 and errors on 8.0
add_action('widgets_init', create_function('', 'return register_widget("Banners125");'));
Any suggestion on how i can fix this code in my wordpress theme for php 8.0?
I would like it to work on php 8.0

A: The function create_function was deprecated in 7.2 and removed in 8.0. Your code can be rewritten in several ways, one of which is:
add_action(
    'widgets_init',
    function() {
        return register_widget("Banners125");
    }
);

