Help with Undefined Variable
| From: | Steve Matzura | Date: | Sat, 05 Oct 2024 16:34:16 +0000 |
| Subject: | Help with Undefined Variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-328547@lists.php.net to get a copy of this message | ||
I have a script referencing a variable, $updated_time, which throws the following error when run:
PHP Warning: Undefined variable $updated_time in blahblahblah/mail_gallery_updates.php on line 60
Line 60 is the line in the script that defines $updated_time:
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?