Environmental Variables and Associative Arrays

$_SERVER Variable

CONTEXT_DOCUMENT_ROOT: /home/walker/public_html
CONTEXT_PREFIX:
DOCUMENT_ROOT: /home/walker/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTPS: on
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING: br,gzip
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.5
HTTP_CONNECTION: Keep-Alive
HTTP_HOST: walker.cs.grinnell.edu
HTTP_IF_MODIFIED_SINCE: Mon, 05 Jun 2023 14:31:17 GMT
HTTP_USER_AGENT: CCBot/2.0 (https://commoncrawl.org/faq/)
PATH: /bin:/usr/bin
QUERY_STRING:
REDIRECT_STATUS: 200
REMOTE_ADDR: 3.236.142.143
REMOTE_PORT: 36542
REQUEST_METHOD: GET
REQUEST_SCHEME: https
REQUEST_URI: /courses/325.fa08/labs/env-variables.php
SCRIPT_FILENAME: /home/walker/public_html/courses/325.fa08/labs/env-variables.php
SCRIPT_NAME: /courses/325.fa08/labs/env-variables.php
SERVER_ADDR: 165.227.97.167
SERVER_ADMIN: webmaster@walker.cs.grinnell.edu
SERVER_NAME: walker.cs.grinnell.edu
SERVER_PORT: 443
SERVER_PROTOCOL: HTTP/1.1
SERVER_SIGNATURE:
SERVER_SOFTWARE: Apache
SSL_TLS_SNI: walker.cs.grinnell.edu
TZ: UTC
UNIQUE_ID: ZmxFXXgYgBbrqdeYGHABhgAAAJI
PHP_SELF: /courses/325.fa08/labs/env-variables.php
REQUEST_TIME_FLOAT: 1718371678.005
REQUEST_TIME: 1718371678
argv:
Warning: Array to string conversion in /home/walker/public_html/courses/325.fa08/labs/env-variables.php on line 25
Array
argc: 0

Copy of $_SERVER Variable

CONTEXT_DOCUMENT_ROOT: /home/walker/public_html
CONTEXT_PREFIX:
DOCUMENT_ROOT: /home/walker/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTPS: on
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING: br,gzip
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.5
HTTP_CONNECTION: Keep-Alive
HTTP_HOST: walker.cs.grinnell.edu
HTTP_IF_MODIFIED_SINCE: Mon, 05 Jun 2023 14:31:17 GMT
HTTP_USER_AGENT: CCBot/2.0 (https://commoncrawl.org/faq/)
PATH: /bin:/usr/bin
QUERY_STRING:
REDIRECT_STATUS: 200
REMOTE_ADDR: 3.236.142.143
REMOTE_PORT: 36542
REQUEST_METHOD: GET
REQUEST_SCHEME: https
REQUEST_URI: /courses/325.fa08/labs/env-variables.php
SCRIPT_FILENAME: /home/walker/public_html/courses/325.fa08/labs/env-variables.php
SCRIPT_NAME: /courses/325.fa08/labs/env-variables.php
SERVER_ADDR: 165.227.97.167
SERVER_ADMIN: webmaster@walker.cs.grinnell.edu
SERVER_NAME: walker.cs.grinnell.edu
SERVER_PORT: 443
SERVER_PROTOCOL: HTTP/1.1
SERVER_SIGNATURE:
SERVER_SOFTWARE: Apache
SSL_TLS_SNI: walker.cs.grinnell.edu
TZ: UTC
UNIQUE_ID: ZmxFXXgYgBbrqdeYGHABhgAAAJI
PHP_SELF: /courses/325.fa08/labs/env-variables.php
REQUEST_TIME_FLOAT: 1718371678.005
REQUEST_TIME: 1718371678
argv:
Warning: Array to string conversion in /home/walker/public_html/courses/325.fa08/labs/env-variables.php on line 40
Array
argc: 0

Sorted Copy of $_SERVER Variable

0:
1:
2:
3: /bin:/usr/bin
4: /courses/325.fa08/labs/env-variables.php
5: /courses/325.fa08/labs/env-variables.php
6: /courses/325.fa08/labs/env-variables.php
7: /home/walker/public_html
8: /home/walker/public_html
9: /home/walker/public_html/courses/325.fa08/labs/env-variables.php
10: 0
11: 165.227.97.167
12: 200
13: 1718371678
14: 1718371678.005
15: 3.236.142.143
16: 443
17: 36542
18: Apache
19: CCBot/2.0 (https://commoncrawl.org/faq/)
20: CGI/1.1
21: GET
22: HTTP/1.1
23: Keep-Alive
24: Mon, 05 Jun 2023 14:31:17 GMT
25: UTC
26: ZmxFXXgYgBbrqdeYGHABhgAAAJI
27: br,gzip
28: en-US,en;q=0.5
29: https
30: on
31: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
32: walker.cs.grinnell.edu
33: walker.cs.grinnell.edu
34: walker.cs.grinnell.edu
35: webmaster@walker.cs.grinnell.edu
36:
Warning: Array to string conversion in /home/walker/public_html/courses/325.fa08/labs/env-variables.php on line 55
Array

$_SERVER Variable — Again

CONTEXT_DOCUMENT_ROOT: /home/walker/public_html
CONTEXT_PREFIX:
DOCUMENT_ROOT: /home/walker/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTPS: on
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING: br,gzip
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.5
HTTP_CONNECTION: Keep-Alive
HTTP_HOST: walker.cs.grinnell.edu
HTTP_IF_MODIFIED_SINCE: Mon, 05 Jun 2023 14:31:17 GMT
HTTP_USER_AGENT: CCBot/2.0 (https://commoncrawl.org/faq/)
PATH: /bin:/usr/bin
QUERY_STRING:
REDIRECT_STATUS: 200
REMOTE_ADDR: 3.236.142.143
REMOTE_PORT: 36542
REQUEST_METHOD: GET
REQUEST_SCHEME: https
REQUEST_URI: /courses/325.fa08/labs/env-variables.php
SCRIPT_FILENAME: /home/walker/public_html/courses/325.fa08/labs/env-variables.php
SCRIPT_NAME: /courses/325.fa08/labs/env-variables.php
SERVER_ADDR: 165.227.97.167
SERVER_ADMIN: webmaster@walker.cs.grinnell.edu
SERVER_NAME: walker.cs.grinnell.edu
SERVER_PORT: 443
SERVER_PROTOCOL: HTTP/1.1
SERVER_SIGNATURE:
SERVER_SOFTWARE: Apache
SSL_TLS_SNI: walker.cs.grinnell.edu
TZ: UTC
UNIQUE_ID: ZmxFXXgYgBbrqdeYGHABhgAAAJI
PHP_SELF: /courses/325.fa08/labs/env-variables.php
REQUEST_TIME_FLOAT: 1718371678.005
REQUEST_TIME: 1718371678
argv:
Warning: Array to string conversion in /home/walker/public_html/courses/325.fa08/labs/env-variables.php on line 69
Array
argc: 0