Created
August 17, 2020 22:00
-
-
Save phpfiddle/f1c43f6645f766b761f611a7a371af00 to your computer and use it in GitHub Desktop.
[ Posted by Sohaib Karim ] PHP 1D And 2D Array in Table Format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$movies = array( | |
array('Bad Boys For Life' , 'Comedy' , 'Mike Judge' ), | |
array('To Little' , 'Action' , 'Andy / Larry Wachowski' ), | |
array('Jumanji The Next Level' , 'Comedy / Adventure' , 'Sofia Coppola' ), | |
array('IP Man 4' , 'Action' , 'Ron Howard' ), | |
array('SpiderMan Far From Home' , 'Adventure' , 'Jared Hess' ) | |
); | |
echo '<table border="1">'; | |
echo '<tr> | |
<th>Movies</th> | |
<th>Genre</th> | |
<th>Director</th> | |
</tr>'; | |
foreach( $movies as $movie ) | |
{ | |
echo '<tr>'; | |
foreach( $movie as $key ) | |
{ | |
echo '<td>'.$key.'</td>'; | |
} | |
echo '</tr>'; | |
} | |
echo '</table>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment