php research
php research
Write a program that Passes control to another page (include, require, exit
9. and die functions) CO1, CO2
10. Write a program to validate the form data using Filter_var() function. CO1, CO2
11. Write a program to show the usage of Cookie. CO1, CO2
12. Write a program to show the usage of Session CO1, CO2
14. Do Form handling In PHP Design a personal Information form , then CO1, CO2
Submit &
Retrieve the Form Data Using $_GET(), $_POST() and $_REQUEST()
Variables
15. Design A Login Form and Validate that Form using PHP Programming CO1, CO2
16. Create Admin Login ,Logout form using session variables CO1, CO2
17. Write a program to create a file. CO1, CO2
18. Write a program that use various PHP library functions, and that CO1, CO2
manipulate files and
directories.
19. Write a program to read and display the content of previously created file. CO1, CO2
20. Write a program to modify the content of an existing file. CO1, CO2
21. Create a web page and which provides File uploading and downloading a CO1, CO2
file.
22. Design a from which upload And Display Image in PHP CO1, CO2
25. Write a program to create a table and insert few records into it using form. CO1, CO2
26. Write a program to select all the records and display it in table. CO1, CO2
28. Write a PHP script, to check whether the page is called from 'https' or CO1, CO2
'http'.
29. Write a program to verify text data as per the pattern. CO3
code:
<?php
if(preg_match($reg, $ogstring)) {
echo("og string only has upper and lower case alphabets ");
}
else {
echo("Only letters and white space");
}
?>
Output:
Practical No. 2
Write a program to show the usage of nested if statement.
code:
<?php
$age = 19;
$voter_id = true;
Output:
Practical No. 3
$integer = 123;
$str = (string) $integer;
echo "Integer to String: $str<br>";
// Float to Integer
$float = 45.67;
$int = (int) $float;
echo "Float to Integer: $int<br>";
// String to Integer
$strn = "789";
$intstr = (int) $strn;
echo "String to Integer: $intstr<br>";
// Boolean to Integer
$boolean = true;
$intbool = (int) $boolean;
echo "Boolean to Integer: $intbool<br>";
?>
Output:
Practical No. 4
// Display menu
echo "Menu: <br>";
echo "1. bca <br>";
echo "2. mca<br>";
echo "3. btech <br>";
echo "4. Exit <br>";
case 2:
echo "You selected mca <br>";
echo "MCA full form is Masters in Computer Applications. It is a professional post-
graduation degree in computer science. The course aims to prepare students for a flourishing
corporate IT culture with exposure.<br>";
break;
case 3:
echo "You selected btech <br>";
echo " BTech full form is Bachelor of Technology which is an undergraduate four-year
course and is offered in various disciplines and specialisations.<br>";
break;
case 4:
echo "Exiting the program. <br>";
break;
default:
echo "Invalid choice. Please enter a number between 1 and 4.\n";
break;
}
?>
output:
.
Practical No. 5
?>
Output:
Practical No. 6
// Original arr
$arr = [3, 1, 4, 1, 5, 9, 2, 6, 5];
$seccarr = ['b' => 3, 'a' => 1, 'd' => 4, 'c' => 2];
// sort()
echo "sort(): ";
sort($arr);
$arrlength = count($arr);
for($x = 0; $x < $arrlength; $x++) {
echo $arr[$x];
echo "<br>";
}
// rsort()
echo "<br>rsort(): ";
$arr = array(4, 6, 2, 22, 11);
rsort($arr);
$arrlength = count($arr);
for($x = 0; $x < $arrlength; $x++) {
echo $arr[$x];
echo "<br>";
}
// asort()
echo "<br>asort(): ";
ksort($seccarr);
// arsort()
echo "<br>arsort(): ";
krsort($seccarr);
?>
output:
Practical No. 7
// array_pad()
echo "array_pad():<br>";
$arr1 = [1, 2, 3];
$oparr1 = array_pad($arr1, 5, 0);
foreach ($oparr1 as $value) {
echo $value . " ";
}
echo "<br><br>";
// array_slice()
echo "array_slice():<br>";
$arr2 = ['apple', 'banana', 'cherry', 'date', 'elderberry'];
$oparr2 = array_slice($arr2, 2, 3);
foreach ($oparr2 as $value) {
echo $value . " ";
}
echo "<br><br>";
// array_splice()
echo "array_splice():<br>";
$arr3 = ['red', 'green', 'blue', 'yellow'];
$oparr3 = array_splice($arr3, 1, 2, ['purple', 'orange']);
// list()
echo "list() Function:<br>";
$fruits = ['apple', 'banana', 'cherry'];
list($first, $second, $third) = $fruits;
echo "First fruit: $first<br>";
echo "Second fruit: $second<br>";
echo "Third fruit: $third<br>";
?>
Output:
Practical No. 8
function Factorial($num) {
$factorial = 1;
return $factorial;
}
$Length = 5;
$Width = 8;
$Area = Area($Length, $Width);
?>
Output: