1.simple and 1st program of php:-
<?php
echo "this is my first program.;"
>
o/p= this is my first program.
here "echo" keyword is used for print the data. we start php with "<php " and end with ">"
<?php
echo "this is my first program.;"
>
o/p= this is my first program.
here "echo" keyword is used for print the data. we start php with "<php " and end with ">"
2.program Switch case in php
<?php
$day="sun";
switch ($day)
{
case "sun":
echo "today is Sunday";
break;
case "Monday":
echo "today is Monday";
break;
case "Tuesday":
echo "today is Tuesday";
break;
case "Wednesday":
echo "today is Wednesday";
break;
default:
echo "today is ?";
}
?>
3.If-else condition program in php
<?php
$a=10;
if($a=10)
{
echo "this is true";
}
else
{
echo"this is false";
}
?>
o/p= this is true
we take a variable "a" and it's value is 10.
in php we define variable with '$'
after this we define apply if condition . if a = 10 then it print "this is true"
otherwise it print "this is false".
3.If-else condition program in php
<?php
$a=10;
if($a=10)
{
echo "this is true";
}
else
{
echo"this is false";
}
?>
o/p= this is true
we take a variable "a" and it's value is 10.
in php we define variable with '$'
after this we define apply if condition . if a = 10 then it print "this is true"
otherwise it print "this is false".
No comments:
Post a Comment