What measures can be taken to prevent sensitive information, like passwords, from being exposed in PHP scripts during debugging or production?

Sensitive information like passwords can be prevented from being exposed in PHP scripts during debugging or production by storing the sensitive information in environment variables and accessing them using the `getenv()` function in PHP. This way, the passwords are not hard-coded in the script and are kept separate from the codebase.

```php
$password = getenv('DB_PASSWORD');
```

This code snippet retrieves the password from an environment variable named `DB_PASSWORD` and assigns it to the `$password` variable. This way, the password is not directly visible in the code and is securely stored in an environment variable.