Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Notice: Undefined offset:

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Notice: Undefined offset:

Postby rickelis » Sun Nov 11, 2012 11:25 am

Hi everyone, I have been with this problem for a few days and nearly loosing it!

This is an assignment for college and I have managed to do all the tasks required. But I keep on getting these errors :

Notice: Undefined offset: 5 in ./whileFile.php on line 33

Notice: Undefined offset: 8 in ./whileFile.php on line 41

Notice: Undefined offset: 7 in ./whileFile.php on line 44

They are the keys of the array I have exploded.

My code is below, any help much appreciated!!!

$detail = separate ($handle);

// Explodes the data within the array with a forward slash
$subject = single($detail[5]);

if ($subject[0] == $value)
{
$dir++;
}

// Adds all the bytes and stores them in $totalBytes
$totalBytes = $totalBytes + (int)($detail[8]);

$errorT = "404";
if ($detail[7] == $errorT)
{
$fileNotFound++;
if (!in_array($detail[5], $errors))
{
$errors[] = $detail[5];
}
}

}
rickelis
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sun Nov 11, 2012 11:09 am

Re: Notice: Undefined offset:

Postby MeroD » Sun Nov 11, 2012 10:05 pm

Have you tried printing out the array to see exactly how the data/keys is structured?

echo "<pre>" . print_r($detail,true) . "</pre>";
MeroD
New php-forum User
New php-forum User
 
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.