simple programs in php

simple programs in php

ex1:print a word

<?php
echo "test";
?>

ex2:add two numbers
<?php
$a=50;
$b=100;
echo $c=$a+b;
?>
ex3: print date

<?PHP
$date = Date("l - F d, Y");
print("Hello World<BR />\n");
print("Today's date is: $date\n");
?>
ex4:simple email program
<?php
$to = "test@example.com";
$subject = "simple email";
$message = "Hello! This is a simple email message.";
$from = "test1@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
ex5:using switch function
<?php
switch ($x)
{
case 1:
  echo "Number 1";
  break;
case 2:
  echo "Number 2";
  break;
case 3:
  echo "Number 3";
  break;
default:
  echo "No number between 1 and 3";
}
?>
simple file uploading program