How can the use of namespaces in PHP impact the functionality of a script, and when is it appropriate to use them?

Using namespaces in PHP can impact the functionality of a script by allowing you to organize your code into logical groupings, prevent naming conflicts, and improve code readability. It is appropriate to use namespaces when you are working on a large project with multiple classes, libraries, or third-party dependencies to avoid conflicts between class names.

<?php

// Define a namespace for your classes
namespace MyNamespace;

// Use the namespace for your classes
class MyClass {
    // Class implementation
}

// Instantiate a class from the namespace
$obj = new MyClass();