Undefined Variable? But I have defined it
Okay, before anyone approves that theres a duplicate question ... (I've noticed that people who can't answer a question tend to work and look for a duplicate and then report it.)
Here is the duplicate you are looking for: php claims my defined variable is undefined
However, this is not exactly a duplicate. This gives me a solution, but I'm not really looking for this specific solution.
Here's my problem:
Notice: Undefined variable: custom
Now here is my code:
$headers = apache_request_headers(); // Request the visitor headers.
$customheader = "Header: 7ddb6ffab28bb675215a7d6e31cfc759"; //This is what the header should be.
foreach ($headers as $header => $value) {
$custom .= "$header: $value";
}
Clearly $ custom is defined. According to another question, it is global and should be marked as one. But how is it global? And how can I do this (non-global)? The script works fine, it still displays what its supposed to and acts correctly, but when I turn on the error messages, it just displays that notification. I suppose it doesn't need to be fixed at this time, but I would still like to know why it does this.
a source to share