How can large class sizes in PHP affect performance?

Large class sizes in PHP can affect performance by consuming more memory and potentially slowing down the execution of the script. To improve performance, it is recommended to break down large classes into smaller, more manageable classes with specific responsibilities. This can help reduce memory usage and improve the overall performance of the application.

// Before refactoring
class LargeClass {
    // Code for large class
}

// After refactoring
class SmallClass1 {
    // Code for smaller class 1
}

class SmallClass2 {
    // Code for smaller class 2
}