II Cs Php Record
II Cs Php Record
II Cs Php Record
EX NO: 1
DATE:
AIM:
ALGORITHM:
<?php
$array = array
"a"=>"apple",
"b"=>"banana",
"o"=>"orange"
);
print_r(array_flip($array));
?>
<?php
$name=array("php","java","html");
$a=count($name);
?>
array_search(search_value,$array,option);
<?php
$num=array(20,50,10);
$key=array_search(50,$num);
print_r($num);
?>
D. ARRAY SUM FUNCTION
<?php
$num = array(20,50,10);
?>
CONTROL STATEMENTS
EX NO: 2
DATE:
AIM:
ALGORITHM:
A. IF STATEMNT
<?php
$password="def";
if($password=="def")
$access="allowed";
else
?>
B. ELSE IF STATEMENT
<?php
$a=(rand(1,50));
if($a<="10")
{
else if($a<="20"&&$a>"10")
else
?>
Output:
C. WHILE LOOP STATEMENT
<?php
$array=array('audi'=>'a4',
'bmw'=>'x5',
'lamborghini'=>'5-25 2agato',
'maruti'=>'aulto800',
);
echo "car->";
echo "mode"."<br>";
reset($array);
while(list($key,$value)=each($array))
echo "$key->";
echo "$value"."<br>";
?>
D. DO WHILE STATEMENT
<?php
$i=9;
$j=10;
do
echo "<br>";
do
$i++;
echo "<br>";
while($j==5);
while($i==10);
?>
Output
EXNO: 3 ADDING TWO NUMBERS
DATE:
AIM:
ALGORITHM:
<html>
<body>
<form method="post">
</form>
<?php
if(isset($_POST['submit']))
$number1 =$_POST['number1'];
$number2 =$_POST['number2'];
$sum= $number1+$number2;
?>
</body>
</html>
OUTPUT
RESULT
Thus the above program was executed successfully and was verified.
EXNO: 4 CASCADING STYLE SHEET
DATE:
AIM:
ALGORITHM:
<html>
<body>
<h1 style="color:blue;">A Blue Heading</h1>
<p style="color:red;">A red paragraph.</p>
</body>
</html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p{
color: red;
}
OUTPUT:
RESULT:
Thus the program was excuted and verified succesfully.
FUNCTION
EXNO: 5
DATE:
AIM:
ALGORITHM:
<?php
function myname()
echo "Alex";
myname();
?>
output
<?php
?>
output
RESULT
Thus the above program was executed successfully and output was
verified.
CALCULATOR
EXNO: 6
DATE:
AIM:
ALGORITHM:
<?php
if(isset($_POST['sub']))
$txt1=$_POST['n1'];
$txt2=$_POST['n2'];
$oprnd=$_POST['sub'];
if($oprnd=="+")
$res=$txt1+$txt2;
else if($oprnd=="-")
$res=$txt1-$txt2;
else if($oprnd=="x")
$res=$txt1*$txt2;
else if($oprnd=="/")
$res=$txt1/$txt2;
?>
Calculator
<br>
<br>
<br>
</form>
output
INTERFACE
EXNO: 7
DATE:
AIM:
ALGORITHM:
<html>
<body>
<?php
interface Animal {
echo "Meow";
$animal->makeSound();
?>
</body>
</html>
OUTPUT
RESULT
Thus the above program was executed and output was verified.
INHERITANCE
EXNO: 8
DATE:
AIM:
ALGORITHM:
<html>
<body>
<?php
class Fruit {
public $name;
public $color;
$this->name = $name;
$this->color = $color;
$strawberry->message();
$strawberry->intro();
?>
</body>
</html>
OUTPUT
RESULT
Thus the above program was executed and output was verified.
CONSTRUCTOR
EXNO: 9
DATE:
AIM:
ALGORITHM:
<html>
<body>
<?php
class Fruit {
public $name;
public $color;
function __construct($name) {
$this->name = $name;
function get_name() {
return $this->name;
echo $apple->get_name();
?>
</body>
</html>
OUTPUT
RESULT
Thus the above program was executed and output was verified.
WEBSITE DESIGNING WITH DATABASE CONNECTION
EXNO: 10
DATE:
AIM:
ALGORITHM:
if(isset($_POST['sub']))
$txt1=$_POST['n1'];
$txt2=$_POST['n2'];
$oprnd=$_POST['sub'];
if($oprnd=="+")
$res=$txt1+$txt2;
else if($oprnd=="-")
$res=$txt1-$txt2;
else if($oprnd=="x")
$res=$txt1*$txt2;
else if($oprnd=="/")
$res=$txt1/$txt2;
?>
Calculator
<br>
<br>
RESULT
Thus the above program was executed and output was verified.
FILTER
EXNO: 11
DATE:
AIM:
ALGORITHM:
</head>
<body>
<table>
<tr>
<td>filter name</td>
<td>filter id</td>
</tr>
<?php
foreach(filter_list()as $id=>$filter)
echo '<tr><td>'.$filter.'</td><td>'.filter_id($filter).'</td></tr>';
?>
</table>
</body>
</html>
OUTPUT
RESULT
Thus the above program was executed and output was verified.
BIODATA
EXNO: 12
DATE:
AIM:
ALGORITHM:
<html>
<body>
<h2>Biodata</h2>
<label="a">Name:</label>
<br><br>
<label="a">mother name:</label>
<label="a">mother's occupation:</label>
<br><br>
<label="a">father name:</label>
<label="a">father's occupation:</label>
<br><br>
<label="a">mobile no:</label>
<br><br>
<label="a">address:</label>
<br><br>
<label="a">email id:</label>
<br><br>
<label="a">male</label>
<label="a">female</label>
<label="a">other</label>
<br><br>
<label="a">book reading</label>
<label="a">bike riding</label>
<input type="checkbox" id="a" name="a">
<label="a">sports</label>
<br><br>
</body>
</html>
OUTPUT
RESULT
Thus the above program was executed and output was verified.
STATIC WEBSITE CREATION
EXNO: 13
DATE:
AIM:
ALGORITHM:
A.
<html>
<body>
<center><h1><font color="purple">Kariapatti,virudhunagar-626115</font><h1>
</body>
</html>
B.
<html>
<body>
<center><h1>Nazia College Of Arts & Science<h1>
<center><h1>contact no:1234567892<h1>
</body>
</html>
C.
<html>
<body>
<center>courses</center>
<center><h2>UG COURSES</h2></center>
<center><h2>PG COURSES</h2></center>
</body>
</html>
D.
<html>
<body>
<center>
<body background="OIPCAT0VBSZ.jpg">
<h2>B.ATAMIL</h2>
</center>
</body>
</html>
E.
<html>
<body>
<center>
<body background="OIPCAT0VBSZ.jpg">
<h2><font color="orange">M.ATAMIL</font></h2>
</center>
</body>
</html>
F.
<html>
<body>
<h2>online application</h2>
<label="a">student name:</label>
<br><br>
<br><br>
<label="a">father name:</label>
<label="a">mobile no:</label>
<br><br>
<label="a">aadhaar no:</label>
<br><br>
<label="a">female</label>
<label="a">other</label>
<br><br>
<h2>select department<h2>
<br><br>
<h2>hobbies</h2>
<label="a">book reading</label>
<label="a">bike riding</label>
<label="a">cooking</label>
<br><br>
</body>
</html>
G.
<html>
<body>
</body>
</html>
H.
<html>
<body>
<img src="santhiya.jpg"><br>
<img src="mathu.jpg"><br>
<img src="guru.jpg"><br>
</html>
OUTPUT
RESULT
Thus the above program was executed and output was verified.