Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created August 17, 2020 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/2aaac5aea81f48ea78588ec9cbda373d to your computer and use it in GitHub Desktop.
Save phpfiddle/2aaac5aea81f48ea78588ec9cbda373d to your computer and use it in GitHub Desktop.
[ Posted by Muhammad Sadiq 2849028 ] Php Array assignment
<!DOCTYPE html>
<html>
<head>
<title>Php Assignment</title>
<style type="text/css">
.tblstyl{
color: yellow;
background-color: purple;
width: 100px;
text-align: center;
border-color: green;
border-radius: 20px;
border-width: 5px;
border-style: ridge;
}
</style>
</head>
<body>
<?php
echo "<h1>ARRAY Assignment</h1>";
// One Dimentional Array
$Pro_of_Pak= array('Punjab','Sindh','KPK','Quetta','Gilght');
?>
<table cellspacing="10px" cellspacing="5px" border="13px solid black" class="tblstyl">
<h2>One Dimentional Array</h2>
<tr>
<td colspan="5">Provinces of Pakistan</td>
</tr>
<tr>
<td><?php echo $Pro_of_Pak[0] ?></td>
<td><?php echo $Pro_of_Pak[1] ?></td>
<td><?php echo $Pro_of_Pak[2] ?></td>
<td><?php echo $Pro_of_Pak[3] ?></td>
<td><?php echo $Pro_of_Pak[4] ?></td>
</tr>
</table>
<?php
// Two Dimentional Array
$result= array(array('English','Maths','Biology','Chemistry','Physics'),array('78','87','90','96','86'));
?>
<table border="13px solid red" cellspacing="10px" cellspacing="5px"
class="tblstyl">
<h2>Two Dimentional Array</h2>
<tr>
<td colspan="5">Details Marks Sheet</td>
</tr>
<tr>
<td><?php echo $result[0][0] ?></td>
<td><?php echo $result[0][1] ?></td>
<td><?php echo $result[0][2] ?></td>
<td><?php echo $result[0][3] ?></td>
<td><?php echo $result[0][4] ?></td>
</tr>
<tr>
<td><?php echo $result[1][0] ?></td>
<td><?php echo $result[1][1] ?></td>
<td><?php echo $result[1][2] ?></td>
<td><?php echo $result[1][3] ?></td>
<td><?php echo $result[1][4] ?></td>
</tr>
</table>
<?php
// Three Dimentional Array
$gps= array(array('sadiq','aslam','waleed'),array('aqsa','Sania','Hafiza'),array('Sajjad','Bazai','Naseem'));
?>
<table border="10px" cellspacing="10px" cellspacing="5px"
class="tblstyl">
<h2>3 Dimentional Array</h2>
<tr>
<td colspan="3">Groups of Class</td>
</tr>
<tr>
<td><?php echo $gps[0][0] ?></td>
<td><?php echo $gps[0][1] ?></td>
<td><?php echo $gps[0][2] ?></td>
</tr>
<tr>
<td><?php echo $gps[1][0] ?></td>
<td><?php echo $gps[1][1] ?></td>
<td><?php echo $gps[1][2] ?></td>
</tr>
<tr>
<td><?php echo $gps[2][0] ?></td>
<td><?php echo $gps[2][1] ?></td>
<td><?php echo $gps[2][2] ?></td>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment