-3

I been figuring out for past few weeks and I been messing around with it and still can't fix it. I not sure what wrong with the coding on length.

Error message is - PHP Notice: Undefined index: length

    // Local variables.
    $output      = '';
    $title       = '';
    $description = '';
            // Local variables by uyghur    
    $iTuneImage              = $options['iTuneImage'];
    $programlink     = $options['programlink'];
    $programTag              = $options['programTag'];
    $iTuneAuthor     = $options['iTuneAuthor'];
    $iTunesummary    = $options['iTunesummary'];
    $iTunesSubtitle  = $options['iTunesSubtitle'];
    $iTunesName      = $options['iTunesName'];
    $iTunesEmail     = $options['iTunesEmail'];
    $iTunesKeywords  = $options['iTunesKeywords'];
    $imageTag        = $options['imageTag'];
    $Audiodiscription        = $options['Audiodiscription'];
    $programTag      = $options['programTag'];
    $linkTAG         = $options['linkTAG'];
    $length          = $options['length'];

1 Answers1

2

If "length" is really optional, do this (and the same for any other indices of the array).

$length          = isset($options['length']) ? $options['length'] : null;

If you need length, you should handle this as an error (and the same thing for other indices of the array).

if (!isset($options['length'])) { 
    throw new \Exception('You forgot the length!');
}
// the rest of the code...
Ry-
  • 218,210
  • 55
  • 464
  • 476
Matt
  • 5,478
  • 9
  • 56
  • 95