How we can show on screen two-dimensional array in the form of a table in php? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How we can show on screen two-dimensional array in the form of a table in php?

https://code.sololearn.com/wx58ON8VuuL0/?ref=app

22nd Oct 2017, 9:41 AM
Анна Коваль
Анна Коваль - avatar
6 Answers
+ 4
<?php $group = array( "online"=> array ("Alex", "Amy"), "offline"=> array("John","Jack"), "away"=> array("Anna","Mary") ); foreach($group as $key => $value){ ?> <table border=1> <tr> <th><?php echo $key;?></th> <td><?php echo $value[0]; ?></td> <td><?php echo $value[1]; ?></td> </tr> </table> <?php } ?>
22nd Oct 2017, 10:39 AM
Ankit Agrawal
Ankit Agrawal - avatar
+ 1
Thank you. What mean "?" in code HTML?
22nd Oct 2017, 10:53 AM
Анна Коваль
Анна Коваль - avatar
+ 1
<?php?> this is php tag. "?" is the closing of php tag with add >
22nd Oct 2017, 10:57 AM
Ankit Agrawal
Ankit Agrawal - avatar
+ 1
Yes, you can also write it in html for displaying dynamic output like in above example.
22nd Oct 2017, 11:06 AM
Ankit Agrawal
Ankit Agrawal - avatar
+ 1
thank you for your help)
22nd Oct 2017, 11:13 AM
Анна Коваль
Анна Коваль - avatar
0
I see. And we write this part of code in Html, it's right?
22nd Oct 2017, 11:04 AM
Анна Коваль
Анна Коваль - avatar