Create Admin User Programmatically for WordPress PHP

<?php
// add a new admin user programmatically
add_action('init', 'tex_add_new_admin');
function tex_add_new_admin() {
    $username = '';
    $password = '';
    $email = '';

    if ( !username_exists( $username ) && !email_exists( $email ) ) {
        $user_id = wp_create_user( $username, $password, $email );
        $user = new WP_User( $user_id );
        $user->set_role( 'administrator' );
    }
}