> -----Original Message-----
> From: Micah Montoy [mailto:[EMAIL PROTECTED]
> Sent: 09 July 2003 01:37
> 
> A couple more things and I'll stop bugging everyone.  I'm 
> trying to get the
> file name of the string.  If it includes the extension that's 
> fine as well.
> I thought the code below would do this but its not.
> 
>  $filevalue = str_replace("\\\\", "/", $filevalue);
> 
>  //get specific file name
>  $parts = explode("/",$filevalue);
>  $file_name = $parts[count($parts)];  //line 42
> 
> Its giving me error:
> Notice: Undefined offset: 6 in
> c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.ph
> p on line 42

This is because count() returns the number of elements in the array, but because the 
indexes start at zero the highest offset is count($parts)-1 -- so when you try to 
access element count($parts), PHP throws a wobbly.

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