0% found this document useful (0 votes)
3 views

php research

This document outlines a practical file for the Bachelor of Computer Application course at Vivekananda Institute of Professional Studies. It includes a list of programming tasks and exercises related to PHP and MySQL, aimed at developing skills in information technology. The document specifies that a total of 15 practicals must be implemented, with additional tasks potentially assigned by the instructor.

Uploaded by

hrishabhjoshi123
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

php research

This document outlines a practical file for the Bachelor of Computer Application course at Vivekananda Institute of Professional Studies. It includes a list of programming tasks and exercises related to PHP and MySQL, aimed at developing skills in information technology. The document specifies that a total of 15 practicals must be implemented, with additional tasks potentially assigned by the instructor.

Uploaded by

hrishabhjoshi123
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

VIVEKANANDA INSTITUTE OF PROFFESSIONAL STUDIES

VIVEKANANDA SCHOOL OF INFORMATION TECHNOLOGY

BACHELOR OF COMPUTER APPLICATION


Practical file - Fundamental of information technology
BCA - 104

Guru Gobind Singh Indraprastha University


Sector - 16c, Dwarka, Delhi-110078

Submitted to: Submitted by:


Dr. Iti Batra Hrishabh Joshi
2EA
Assistant Professor
E.no :-03929802023
VSIT
S. No. Detailed Statement Mapping to CO Date
#

1. Write regular expressions including modifiers, operators, and CO1, CO2


metacharacters.
2. Write a program to show the usage of nested if statement. CO1, CO2

3. Write a Program in PHP for type Casting Of a Variables CO1, CO2


4. Write a program to create a menu driven program and show the usage of CO1, CO2
switch-case.
5. Write a program to show the usage of for/while/do while loop CO1, CO2
6. Write a program to perform all four types of sorting CO1, CO2
7. Write a program to implement Array- CO1, CO2
pad(),aaray_slice(),array_splice(),list()
functions.(use foreach wherever applicable)
8. Write a program to show the application of user defined functions. CO1, CO2

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

13. Write a program to implement oops concepts. 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

23. Use phpMyAdmin and perform the following: CO1, CO2


import, review data and structure, run SQL statements, create users and
privileges
24. Write a program to create a mysql database. 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

27. Write a program to modify (delete/modify/add) a table. CO1, CO2

28. Write a PHP script, to check whether the page is called from 'https' or CO1, CO2
'http'.

Application Based Practical

29. Write a program to verify text data as per the pattern. CO3

30. Create a dynamic website by incorporating the following functionalities: CO3


• Implement a basic registration and login system, with styling,
• Make the database connection
• Make a connection to a MySQL database, and log in with valid
credentials.
• Create Dynamic, interactive and database - Driven web
application using php & mysql
• Perform some validation check. If any of these operations cause
an error, stop execution and print the error message. The script should
respond differently depending on the situation.
Add a “Log Out” button to logout from the system
Note:
1. In total 15 practical’s to be implemented.
2. 2 additional practical may be given by the course instructor.
This is a suggestive list of programs. However, the instructor may add programs as per the
requirement of the course.
Practical No. 1
Write regular expressions including modifiers, operators, and
metacharacters.

code:

<?php

$reg = '/^[a-zA-Z ]*$/';

$ogstring = "hello world";

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;

// Applying conditions on university and course


if ($age >= 18) {
if ($voter_id) {
echo "Eligible to vote";
}
else {
echo "you dont have voter id card";
}
}
else {
echo "You are underage";
}
?>

Output:
Practical No. 3

Write a Program in PHP for type Casting of a Variables.


.
code:
<?php

$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

Write a program to create a menu driven program and show


the usage of switch-case.
code:
<?php

// Display menu
echo "Menu: <br>";
echo "1. bca <br>";
echo "2. mca<br>";
echo "3. btech <br>";
echo "4. Exit <br>";

// Get user choice


$choice = 1;

// Use switch-case to perform actions based on user choice


switch ($choice) {
case 1:
echo "You selected bca <br>";
echo "A Bachelor of Computer Application degree is the core of Computer Science in
today's world. BCA is a three-year degree program. This degree is for those who want to
study computer science, software engineering, information technology, information security,
and networking technology.<br>";
break;

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

Write a program to show the usage of for/while/do while loop.


code:
<?php
echo "For Loop:<br>";
for ($i = 1; $i <= 5; $i++) {
echo " $i<br>";
}

echo "<br>While Loop:<br>";


$j = 1;
while ($j <= 5) {
echo " $j<br>";
$j++;
}

echo "<br>Do-While Loop:<br>";


$k = 1;
do {
echo " $k<br>";
$k++;
} while ($k >= 5);

?>

Output:
Practical No. 6

Write a program to perform all four types of sorting.


sort
rsort
asort
ksort
.
<?php

// 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);

foreach($seccarr as $x => $x_value) {


echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}

// arsort()
echo "<br>arsort(): ";
krsort($seccarr);

foreach($seccarr as $x => $x_value) {


echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}

?>

output:
Practical No. 7

Write a program to implement Array-


pad(),aaray_slice(),array_splice(),list()functions.(use foreach
wherever applicable).
code:
<?php

// 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']);

foreach ($arr3 as $value) {


echo $value . " ";
}
echo "<br><br>";

// 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

Write a program to show the application of user defined


functions.
code:
<?php

function Area($length, $width) {


$area = $length * $width;
return $area;
}

function Factorial($num) {
$factorial = 1;

for ($i = 1; $i <= $num; $i++) {


$factorial *= $i;
}

return $factorial;
}

$Length = 5;
$Width = 8;
$Area = Area($Length, $Width);

echo "Area of the rectangle is: $Area<br>";


$num = 5;
$fact = Factorial($num);

echo "Factorial of $num is: $fact";

?>

Output:

You might also like