I am new to programming, and I decided to try PHP.
I am trying to set the variable $_SERVER["SERVER_NAME"].
Unfortunately, I'm getting some errors.
The code is copied from this Youtube tutorial, so it is supposed to be correct.
$server = [
         'Host Server Name' => $_SERVER['SERVER_NAME'],
         'Host Header' => $_SERVER['HTTP_HOST'],
         'Server Software' => $_SERVER['SERVER_SOFTWARE'],
         'Document Root' => $_SERVER['DOCUMENT_ROOT'],
         'Current Page' => $_SERVER['PHP_SELF'],
         'Script Name' => $_SERVER['SCRIPT_NAME'],
         'Absolute Path' => $_SERVER['SCRIPT_FILENAME']
];
//print_r($server);
// Create Client Array
$client = [
    'Client System info' => $_SERVER['HTTP_USER_AGENT'],
    'Client IP' => $_SERVER['REMOTE_ADDR'],
    'Remote Port' => $_SERVER['REMOTE_PORT']
];
The error:
Notice: Undefined variable:** server in C:\xampp\htdocs\phpsandbox\website2\server-info.php on line 7
Fatal error: Uncaught Error: Unsupported operand types in C:\xampp\htdocs\phpsandbox\website2\server-info.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\phpsandbox\website2\server-info.php on line 7
Thanks to anyone for the support!