> -----Original Message-----
> From: Chris Hewitt [mailto:[EMAIL PROTECTED]]
> Sent: 24 January 2003 09:13
> 
> [EMAIL PROTECTED] wrote:
> 
> >I modifiy my php.ini to redirect error message in log of 
> server web and I change
> >error_reporting  =  E_ALL & ~E_NOTICE by error_reporting  =  E_ALL
> >
> >Now, I get in server log this message :
> >[24-Jan-2003 08:59:31] PHP Notice:  Undefined offset:  4 in 
> /appli/PHP/test/__xyz__.php on
> >line 15
> >and I get all code HTML : the program doesn't fail !
> >
> That is working correctly, it is what should happen. You changed your 
> error reporting to include "notices". These are not errors 
> but warnings 
> to tell you that you _may_ have something not right.

Correct.

> 
> In this case, an undefined offset means that the variable you used in 
> the offset has not been previously set a value, so:
> $myarray[$myoffset];
> will produce this error if $myoffset has not already been set 
> a value. 
> If you do:
> $myoffset = 4;
> $myarray[$myoffset];
> then you should not get the warning.

Wrong.  The offset is 4, the error message says so.  Undefined offset means you are 
trying to access a character from a string that doesn't exist -- in this case, the 5th 
character of a string that is shorter than 5 characters.  (If $myoffset was undefined, 
you'd get an undefined variable warning.)

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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to