Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
<? Php
$ my name = Amit;
$ my letter = 4 ;
echo $ my name;
echo $ my letter;
?>
Write a program to demonstrate local and global variable in php.int
<? php
$ X = 4;
Function assign()
$ X = 0;
assign();
?>
Write a program to demonstrate function parameters in php
<? Php
$value = value * 10 ;
Return $ value;
?>
Write a program to adding a two numbers using parameters
<? php
$a =10;
$b = 20;
$ sum = 0 ;
$ sum = $a + $b;
?>
Write a program to demonstrate logical operators in php
<html>
<head>
<? php
$a = 42;
$b = 0;
Else
?>
</head>
</html>
Write a program to demonstrate comperigan operator in php
<html>
<head>
</head>
<body>
<? php
$a = 42;
$b= 20;
If ($a == $b)
else
?>
</body>
</html>
Write a program to print Have a nice Weekend! If the current day is Friday
otherwise it will output Have a nice day!
<html>
<body>
<? php
$d = date (D);
if ($d == fri)
else
?>
</body>
</html>
Write a program to print 1-10 Numbers for loop in php
<html>
<body>
<? php
?>
</body>
</html>
Write a program to print five iteration and changes the assigned value of two
variables on each pass of the loop
<html>
<body>
<? php
$a + = 10 ;
$b + = 5 ;
?>
</body>
</html>
Write a program to print Have a nice Weekend! if the current day is Friday
and Have a nice Sunday! if the current day is Sunday otherwise it will Have
a nice day!.
<html>
<body>
<? php
$d = date (D);
if ($d == fri)
else
?>
</body>
</html>
Write a program to print 1-10 numbers by using php
<html>
<body>
<? php
$i=1;
$i = $1+1;
?>
</body>
</html>
Write a program to decrement the variable value on each iteration of the loop and the
counter increment until it reaches to when.
<html>
<body>
<? php
$i=0;
$sum = 50;
$num i
$ i++
?>
</body>
</html>
Write a program to array in php
<html>
<body>
<? php
?>
</body>
</html>
Write a program to print 1-10 numbers by using do while loop in php.
<html>
<body>
<? php
$i =1;
do
echo (Value of I is = $ I );
$ I = $ i++ ;
while ( $i<10);
?>
</body>
</html>
Write a program to list out the values of an array using in php.
<html>
<body>
<? php
$array = array(1,2,3,4,5);
?>
</body>
</html>
Write a program to the loop and print the value of array but when the condition
becomes true, it just skips the code and next value is printed
<html>
<body>
<? php
$array = array(1,2,3,4,5);
if ( $value == 3 ) continue;
?>
</body>
</html>
Write a program for condition test becomes true when the counter value reaches 3
and loop terminates
<html>
<body>
<? php
$i = 0;
While ($i<10)
$i++;
?>
</body>
</html>
Write a program to demonstrate string in php.
<? php
$ variable = name;
print ($ literally);
print ($ literally);
?>
<? php
?>
<? php
?>