You are here: Foreach Loop with Nested Arrays « PHP Programming Language « IT news, forums, messages
Foreach Loop with Nested Arrays

Posted by TSmith on 06/14/07 16:52

Hey Y'all,

I haven't programmed in PHP in quite a while. Could anyone help me
with a foreach loop in a nested array? I have a function which returns
$stock (for an online pricing catalog).

$stock[0] is ( [0] => Item, [1] => Sale, ...) an array of column
headers.
$stock[1][$i] is ([Item] => SL, [Sale] => 300, ...) an array of
column headers to value for item $i

What I have to print the header row for the pricing table is:
print("<TR>");
foreach ($stock[0] as $num => $val) {
print("<TH>" + $val + "</TH>");
}
print("</TR>");

I've also tried ($stock[0] as $x) print($x).

What returns is five zeroes. Not in table cells, just "<TR>00000</
TR>".

Does anyone have any ideas what I've done?

Thank you in advance,
Taylor Smith

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация