How can the issue of storing a server name in a PHP script be resolved without violating the concept of constants?

Storing a server name in a PHP script without violating the concept of constants can be achieved by using a configuration file. This file can store the server name as a variable that can be easily accessed and updated without changing the main PHP script. By including the configuration file in the main script, the server name can be retrieved whenever needed.

// config.php
<?php
$serverName = "example.com";
?>

// main.php
<?php
include 'config.php';
echo "Server Name: " . $serverName;
?>