Re: ARRAY
| From: | ROBERT MCPEAK | Date: | Wed, 10 Dec 2003 18:29:43 +0000 |
| Subject: | Re: ARRAY | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-172370@lists.php.net to get a copy of this message | ||
Because it's and array! print and echo take strings, not arrays, I believe. Anyway, print_r()
or a foreach loop will do it for you.
<?php
print_r($table);
//or
foreach ($table as $atable){
echo "$table<Br>";
}
?>
Something like that.
>>> Brian Sutton <webmaster@briansutton.com> 12/10/03 01:26PM >>>
I am trying to read in a text file to an array using the following code,
however everytime I try and print the contents of the $table array, it
always says "ARRAY". Why won't it show me the actual contents of the file?
$row = 1;
$handle = fopen ("seclog.txt","r");
while ($data = fgetcsv ($handle, 1000, ",")) {
$num = count ($data);
print "<p> $num fields in line $row: <br>\n";
$row++;
for ($c=0; $c < $num; $c++) {
print $data[$c] . "<br>\n";
$table[] = $data;
}
}
fclose ($handle);
print $table;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php