PHP Array - How to loop through an array

Posted by Homer_J on Stack Overflow See other posts from Stack Overflow or by Homer_J
Published on 2010-04-23T15:31:27Z Indexed on 2010/04/23 15:33 UTC
Read the original article Hit count: 275

Filed under:

Hi

My array is as follows:

Array ( [questions] => q1 [qnum] => 1 [qtext] => I love crisps [page] => 1 )
Array ( [questions] => q2 [qnum] => 2 [qtext] => I love chocolate [page] => 1 )

All I would like to do is print the contents of the array in a loop, so it looks something like:

q1 1 I love crisps
q2 2 I love chocolate

If anyone could supply the PHP and HTML code, that would be great, thanks.

Homer.

© Stack Overflow or respective owner

Related posts about php