Function expects string but receiving array Warming??
| From: | Jean-Christian Imbeault | Date: | Tue, 03 Sep 2002 08:20:28 +0000 |
| Subject: | Function expects string but receiving array Warming?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-114990@lists.php.net to get a copy of this message | ||
I get the following warning which makes no sense to me.
Warning: header() expects parameter 1 to be string, array given in /www/htdocs/jc/administration/edit_products/show_products.php on line 96
It's true that I am passing at an array to the function, but what I don't understand is why the function expects a string?
How does any function know the type of an incoming var in PHP anyway?
How can I fix my code to get rid of this error (while keeping the var as an array)?My code looks like this:
header(array("ID","Name","Maker's Code","Maker Name","Label Name","Product Type"));
function header_row($aH) {
echo " <TR>";
foreach ($aH as $h) {
?>
<TH>
<?php echo $h; ?>
</TH>
<?php
}
echo " </TR>";
}