What are some key differences between including files using require_once and using namespaces in PHP?

When including files in PHP, using require_once includes the file's code directly into the current script, making all functions and classes available immediately. On the other hand, using namespaces allows for better organization and avoids naming conflicts by grouping classes and functions under a specific namespace. Namespaces provide a more structured and modular approach to managing code in larger projects.

// Using require_once to include a file
require_once 'file.php';

// Using namespaces to organize code
namespace MyNamespace;

class MyClass {
    // class code here
}