Amazon.com: PC Books || Educational Software || Magazines
Amazon: Books-CA || Software-CA || Books-UK || Software-UK

HTML | Javascript | ASP | PHP | VBScript | SQL | Hardware | PC FAQ| WinXP|

Learn to Build, Upgrade, or Repair your Computer Ebook + PC Safety 101 kwwebservice.com Reasonably priced web development & hosting
PHP Basics
Introduction
Variables & Arrays
Sub & Functions
If Statements
Case Statements
Loop Statements
Date Objects
Form Processing
Text File Objects
Database Access
Adding Record
Updating Record
Deleting Record
Virtual Includes
Cookies
Session
Server Variables
Creating Login Page
E-mail
PHP Books @
CA Amazon
UK Amazon
US Amazon

  :: Home
PC Topics
  :: Build A PC
  :: Windows XP
  :: PC Help
Tutorials
  :: HTML
  :: JavaScript
  :: ASP
  :: PHP
  :: VBScript
  :: SQL
Miscellaneous
  :: Code/Scripts
  :: Forum
  :: Links
  :: Contact us
  :: Tell A Friend
  :: In Somali
  ::
Web Articles
  Top Web Hosting
Reviews
  Processing
Online Card Payment Guide
  Domain name
registration & buying guide
  Getting
a website online guide
  Search Engine
submission & optimization tips
Netfirms Web Hosting
Free trial
Quality business correspondence.
Yahoo! Search Marketing


PHP Switch Statements

Switch statement can be used instead of if statement suitably when one condition could have multiple possibilities. Following example illustrates the use of switch statement
<?php
$dat=date("w");
switch ($dat)
{
  case 0:
    print("Today is Sunday");
   break;
  case 1:
    print("Today is Monday");
    break;
  case 2:
    print("Today is Tuesday");
    break;
  case 3:
    print("Today is Wednesday");
    break;
  case 4:
    print("Today is Thursday");
    break;
  case 5:
    print("Today is Friday");
    break;
    case 6:
    print("Today is Saturday");
    break;
  }
?>
This example is illustrate use of case statement or switch statement. You might not need that much coding to display day of the week. There is other short functions to use.  The variable $dat is set to the day of the week and it could have values from 0 to 6, 0 is Sunday and 6 is Saturday.  Switch statement is used to display the day of the week according to the value of variable dat.

date("w") is a function that returns a number value representing day of the week.
Execution result:
Today is Saturday

If Statements Loops
Bluehost.com Web Hosting $6.95
PC System Tools
SpyCleaner
Registry Mechanic
4Diskclean Pro
Health PC Club
TweakNow
Registry Washer
SpyAnyWhere
System Lifeguard
...More/Details

PC Articles
  Computer Safety
prevent viruses & Spyware