RE: [PHP] Undefined offset notices
| From: | Ford, Mike [LSS] | Date: | Thu, 20 Feb 2003 14:30:27 +0000 |
| Subject: | RE: [PHP] Undefined offset notices | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-136359@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Shawn McKenzie [mailto:nospam@mckenzies.net]
> Sent: 20 February 2003 05:55
>
> While debugging my code, that seems to work fine, I see
> hundreds of these
> notices, many different ones with different offset numbers
> same line number.
>
> Notice: Undefined offset: 2 in
> D:\apps\www\test\themes\Family\includes\autotheme.inc.php on line 275
>
> I would like to know what the notice pertains to (offset?)
> Here's the code:
>
> $commands is an associative array, $tmpparts and $tmpcmds are
> integer index
> arrays.
>
> $i = 0; // Line 270
> while($i != count($tmpparts)) {
> $content = "?>".$tmpparts[$i];
> eval($content);
> foreach($command as $name => $cmds) {
> if($tmpcmds[$i] == $name) {
Here, the offset is $i -- it's telling you that there is no $i element in the array $tmpcmds.
> $docmd = $cmds;
> eval($docmd);
> }
> }
> $i++;
> } // Line 281
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211