In PHP, what are the benefits and drawbacks of using constants instead of global variables for sharing data between components?

Using constants instead of global variables in PHP for sharing data between components provides the benefit of ensuring that the data remains constant and cannot be changed accidentally. Constants also have a global scope, making them accessible from anywhere in the code. However, the drawback is that constants are immutable, meaning they cannot be changed during runtime, which may limit their flexibility compared to global variables.

define('SHARED_DATA', 'This is the shared data constant');

echo SHARED_DATA;