Notice: Undefined offset:

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

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)

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

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


New php-forum User
New php-forum User
Posts: 53
Joined: Wed Oct 10, 2012 12:14 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>";

Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests