http://php.flashwebhost.com/vineesh/..._6_array_2.php
PHP Code:
<?php
$timeTables = array();
$timeTable1 = array();
$timeTable1[day] = 'monday';
$timeTable1[teacher] = 'murali';
$timeTable1[subject] = 'english';
$timeTable1[period] = 'first period';
$timeTable1[availability] = 'present';
$timeTable2 = array();
$timeTable2[day] = 'tuesday';
$timeTable2[teacher] = 'chandrika';
$timeTable2[subject] = 'chemistry';
$timeTable2[period] = 'second period';
$timeTable2[availability] = 'present';
$timeTable3 = array();
$timeTable3[day] = 'wednesday';
$timeTable3[teacher] = 'alice';
$timeTable3[subject] = 'biology';
$timeTable3[period] = 'third period';
$timeTable3[availability] = 'absent';
$timeTables[] = $timeTable1;
$timeTables[] = $timeTable2;
$timeTables[] = $timeTable3;
echo '<h2><font=color:red;>Class info: </font> </h2>';
foreach ($timeTables as $timeTable) {
echo '<b> <font color=blue>Day: </font></b>' . ucwords($timeTable[day]) . '<br>';
echo '<b> <font color=blue>Name of the Teacher: </font></b>' . ucwords($timeTable[teacher]) . '<br>';
echo '<b> <font color=blue>Subject:</font></b> ' . ucwords($timeTable[subject]) . '<br>';
echo '<b> <font color=blue>Period: </font></b> ' . ucwords($timeTable[period]) . '<br>';
if ($timeTable[availability] == 'present') {
echo '<p>Students, teacher is on the way, you may go to your classes.</p>';
} if ($timeTable[availability] == 'absent') {
echo '<p>Heyy.. teacher is absent today, you may go home :) </p>';
}
}
Bookmarks