Re: Help with Undefined Variable

richard gray <[email protected]> Sun, 6 Oct 2024 10:46:43 +0100
Newsgroups gmane.comp.php.general
Message-ID <[email protected]>
On 05/10/2024 17:34, Steve Matzura wrote:
> foreach ($shows as $showcode => $showname) {
>
>     if (file_exists("$archive_dir/$showcode")) {
>         $archived = true;
>         if ($debug) {
>             $msg_text .= "Debug: $showname is archived.\n";
>         $updated = get_archive_last_updated($showcode);
>         $updated_time = $updated["time"];
>         $updated_file_date = $updated["file_date"];
>     } else {
>         $archived = false;
>         $updated_time = get_last_updated($showcode);
>     }
> }
>
> Why would PHP think this variable is undefined?
>
the above code snippet is missing a closing brace '}' - I presume ```if 
($debug)``` block is the problem area maybe? Fix that and the error may 
get resolved