What are the potential pitfalls of embedding tests within code, as seen in the provided PHP script?

Embedding tests within code can lead to cluttered and less maintainable code. It can make it harder to separate concerns and can make the code harder to read and understand. A better approach is to use a dedicated testing framework like PHPUnit to keep tests separate from the actual code.

// Separate the tests from the code by using a dedicated testing framework like PHPUnit

// Example of a PHPUnit test class
class MyTestClass extends \PHPUnit\Framework\TestCase {
    public function testSomething() {
        // Test code here
    }
}