Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- table {
- width: 500px;
- border: 4px solid black;
- border-collapse: collapse;
- }
- td {
- border: 0px solid black;
- }
- </style>
- <?php
- $arr = array(
- array("ID", "fname", "lname", "Email"),
- array(1, "Peter", "Andersen", "peter@gmail.com"),
- array(2, "John", "Miller", "john@gmail.com"),
- array(3, "Thomas", "Swift", "thomas@gmail.com")
- );
- for($i=0; $i<count($arr); $i++){
- echo $arr[$i][0] . " " .
- $arr[$i][1] . " " .
- $arr[$i][2] . " " .
- $arr[$i][3] ."<br>";
- }
- echo "<table>";
- for($i=0;$i<count($arr);$i++) {
- echo('<tr>');
- echo('<td>' . $arr[$i][0] . '</td>');
- echo('<td>' . $arr[$i][1] . '</td>');
- echo('<td>' . $arr[$i][2] . '</td>');
- echo('<td>' . $arr[$i][3] . '</td>');
- echo('</tr>');
- }
- echo "</table>";
- echo "<br>";
- echo '<table border="1">';
- echo '<tr><th>ID</th><th>fname</th><th>lname</th><th>email</th></tr>';
- foreach( $arr as $array )
- {
- echo '<tr>';
- foreach( $array as $ispis )
- {
- echo '<td>'.$ispis.'</td>';
- }
- echo '</tr>';
- }
- echo '</table>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement