What is the purpose of the Use-Statement in PHP and how does it relate to autoload functions?

The purpose of the Use-Statement in PHP is to import classes or namespaces into the current namespace, allowing you to use them without having to specify their full namespace every time. This can help improve code readability and reduce redundancy. When used in conjunction with autoload functions, the Use-Statement can simplify the process of loading classes dynamically as needed.

<?php

// Autoload function to automatically load classes when needed
spl_autoload_register(function ($class) {
    include 'classes/' . $class . '.php';
});

// Import the needed class using the Use-Statement
use App\Models\User;

// Now you can use the User class without specifying the full namespace
$user = new User();