What are the common pitfalls when including functions and classes in PHP scripts, and how can they be avoided?

One common pitfall when including functions and classes in PHP scripts is naming conflicts. To avoid this, use namespaces to encapsulate your code and prevent naming collisions with other functions or classes.

// Avoid naming conflicts by using namespaces
namespace MyNamespace;

function myFunction() {
    // Function code here
}

class MyClass {
    // Class code here
}