Array refusing to output
Posted: Tue Feb 08, 2005 6:44 am
Hi, I am constructing a simple php program to take test result files, extract the bits I need, and output them all into a single CVS file. So far, I can harvest the data I need, but I cannot display it (I'm displaying it so I can check it before I output to a file)
Anyway, this is the code:
And this is the output I get:
The arrays are created in the include and I have checked they all work (
As you can see, the arrays have been commented out where I tested them)
Anyway, I canoot understand why I am getting these undefined index errors, as the array clearly displays before I run individual elements. Or perhaps I misunderstand the meaning of the error? Eitherway, if anyone can spot what I have done wrong, I would be very grateful if you could point it out.
Link
Anyway, this is the code:
Code: Select all
<?php
include 'group.php';
include 'time.php';
//print_r(array_values($time1final));
//print_r(array_values($time2final));
print_r(array_values($groupfinal));
$count = count($groupfinal);
$timekey = "0";
while($timekey <= $count ){
echo $groupfinalї$timekey];
echo $time1finalї$timekey];
echo $time2finalї$timekey];
$timekey++;
}
/*foreach ($groupfinal as $key => $value){
//echo $value;
echo $time1finalї$timekey];
//echo $time2finalї$timekey];
echo "\r\n";
$timekey++;
}*/
//print_r(array_values($time1final));
?>Code: Select all
Content-type: text/html
X-Powered-By: PHP/4.3.10
Array
(
ї0] => db74
ї1] => ic74
ї2] => ix74
ї3] => lb74
ї4] => nc74
ї5] => rl74
ї6] => rw74
ї7] => sg74
ї8] => sq74
ї9] => st74
ї10] => th74
ї11] => db85
)
<br />
<b>Notice</b>: Undefined index: 0 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined index: 0 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined index: 0 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 1 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 1 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 1 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 2 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 2 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 2 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 3 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 3 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 3 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 4 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 4 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 4 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 5 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 5 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 5 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 6 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 6 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 6 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 7 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 7 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 7 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 8 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 8 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 8 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 9 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 9 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 9 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 10 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 10 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 10 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 11 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 11 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 11 in <b>c:\php\run.php</b> on line <b>16</b><br />
<br />
<b>Notice</b>: Undefined offset: 12 in <b>c:\php\run.php</b> on line <b>14</b><br />
<br />
<b>Notice</b>: Undefined offset: 12 in <b>c:\php\run.php</b> on line <b>15</b><br />
<br />
<b>Notice</b>: Undefined offset: 12 in <b>c:\php\run.php</b> on line <b>16</b><br />As you can see, the arrays have been commented out where I tested them)
Anyway, I canoot understand why I am getting these undefined index errors, as the array clearly displays before I run individual elements. Or perhaps I misunderstand the meaning of the error? Eitherway, if anyone can spot what I have done wrong, I would be very grateful if you could point it out.
Link