Example #1
0
     foreach ($final_data as $tmpKey => $opt) {
         if ($i == 1) {
             echo "Date : " . $opt['report_for'] . "\n";
             //echo "Max. Temp. : ".$opt['maxVal']."\n";
             //echo "Min. Temp. : ".$opt['minVal']."\n";
             //echo "Diffrence : ".$opt['diff']."\n";
         } else {
             break;
         }
         $i++;
     }
     echo "\n \n";
     break;
 case 'football-report':
     $football_array = makeArrayFromFile($tmp_file_path);
     $final_data = getCal($football_array, 1, 6, 8);
     ksort($final_data);
     echo "Football report from English Premier League for 2001/2 : \n";
     $i = 1;
     foreach ($final_data as $tmpKey => $opt) {
         if ($i == 1) {
             echo "Team Name : " . $opt['report_for'] . "\n";
             //echo "For goals : ".$opt['maxVal']."\n";
             //echo "Against Goals : ".$opt['minVal']."\n";
             //echo "Diffrence : ".$opt['diff']."\n";
         } else {
             break;
         }
         $i++;
     }
     echo "\n \n";
Example #2
0
<?php 
function getCal($month, $year)
{
    $row = 1;
    for ($i = 1; $i <= date("t", mktime(0, 0, 0, $month, 1, $year)); $i++) {
        $dow = date("w", mktime(0, 0, 0, $month, $i, $year));
        if ($dow == 1) {
            $row++;
        }
        $cal[$row][$dow == 0 ? 7 : $dow] = date("d", mktime(0, 0, 0, $month, $i, $year));
    }
    return $cal;
}
$cal = getCal(date("n"), date("Y"));
echo '<table>';
foreach ($cal as $value) {
    echo "<tr>";
    for ($i = 1; $i < 8; $i++) {
        echo "<td>" . $value[$i];
    }
}
echo "</table>";
$cal = getCal(date("n") + 1, date("Y"));
echo '<table>';
foreach ($cal as $value) {
    echo "<tr>";
    for ($i = 1; $i < 8; $i++) {
        echo "<td>" . $value[$i];
    }
}
echo "</table>";