0% found this document useful (0 votes)
19 views25 pages

PHP Practical

pracrical

Uploaded by

Dhyan Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views25 pages

PHP Practical

pracrical

Uploaded by

Dhyan Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

PHP (4341604) SEM 4(IT) Batch: B1

Practical No.2: Variables, Constant and Operators


a. Write a PHP script to demonstrate use of global, local, static variables and constant.
b. Write a PHP script to demonstrate arithmetic operators, comparison operator,
logical operator.
c. Write a PHP program to swap two numbers with and without using third variable.

A)Write a PHP script to demonstrate use of global, local, static variables and
constant.

Input

Output :

22 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

B) Write a PHP script to demonstrate arithmetic operators, comparison operator,


logical operator.

Input:

Output:

23 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

C)Write a PHP program to swap two numbers with and without using third
variable.

Input:

Output:

Assessment-Rubrics
Faculty
Marks Obtained Signature Date

Program Implementation Student’s engagement


Correctness and Presentation in practical activities Total
(4) Methodology (3) (3) (10)
R1 R2 R3

24 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Practical No.3: Conditional Statements


a. Write a PHP script to check the given number is odd or even.
b. Write a PHP script to print student’s grade based on marks of 5 subjects.
c. Create a PHP script to show the month of a year using switch statement.

A) Write a PHP script to check the given number is odd or even.

Input:

Output:

25 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

B) Write a PHP script to print student’s grade based on marks of 5 subjects.

Input:

Output:

26 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

C) Create a PHP script to show the month of a year using switch statement.

Input:

27 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Output:

Assessment-Rubrics
Faculty
Marks Obtained Signature Date

Program Implementation Student’s engagement


Correctness and Presentation in practical activities Total
(4) Methodology (3) (3) (10)
R1 R2 R3

28 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Practical No.4: Looping Structures


a. Write PHP Script to print Fibonacci series in html tabular format.
b. Write a PHP script to print below number triangle.

C .Write a PHP script to create chess board (tabular structure).

A) Write PHP Script to print Fibonacci series in html tabular format.

Input:

Output:

29 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

B)Write a PHP script to print below number triangle.

Input:

Output:

30 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

C) Write a PHP script to create chess board (tabular structure).

Input:

31 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Output:

Assessment-Rubrics
Faculty
Marks Obtained Signature Date

Program Implementation Student’s engagement


Correctness and Presentation in practical activities Total
(4) Methodology (3) (3) (10)
R1 R2 R3

32 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Practical No.5 : Arrays


a. Write PHP Script for addition and multiplication of two 2x2 matrices.
b. Write a PHP Script to count the number of elements in an array without using built-in
function (use numeric and associative arrays).

A)Write PHP Script for addition and multiplication of two 2x2 matrices.

Input:

33 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Output:

34 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

B)Write a PHP Script to count the number of elements in an array without using
built-in function (use numeric and associative arrays).

Input:

Output:

Assessment-Rubrics

Faculty
Marks Obtained Signature Date

Program Implementation Student’s engagement


Correctness and Presentation in practical activities Total
(4) Methodology (3) (3) (10)
R1 R2 R3

35 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Practical No.6: User defined Functions

a. Write a PHP script to call by reference and call by value


b. Write a PHP Script for performing function that takes arguments with default
argument and returns value.
c. Write a PHP Script to show the use of variable length argument.

A)Write a PHP script to call by reference and call by value

Input:

Output:

36 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

B) Write a PHP Script for performing function that takes arguments with default
argument and returns value.

Input:

Output:

C) Write a PHP Script to show the use of variable length argument.


Input:

Output:

Assessment-Rubrics
Faculty
Marks Obtained Signature Date

Program Implementation Student’s engagement


Correctness and Presentation in practical activities Total
(4) Methodology (3) (3) (10)
R1 R2 R3

37 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Practical No.7: Built-In functions


a. Write PHP script to demonstrate the use of various strings handling function.
b. Write a PHP script to demonstrate the use of Include() and require() function.
c. Write PHP script to demonstrate the use of Array functions.
d. Write PHP script to demonstrate the use of fopen(), fread(), fwrite() and fclose() file
functions.

A) Write PHP script to demonstrate the use of various strings handling


function.
Input;

Output:

38 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

B) Write a PHP script to demonstrate the use of Include() and require()


function.

Input:

Output:

39 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

C) Write PHP script to demonstrate the use of Array functions.

Input:

40 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Output:

41 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

D) Write PHP script to demonstrate the use of fopen(), fread(), fwrite() and
fclose() file functions.
Input:

Output:

Assessment-Rubrics
Faculty
Marks Obtained Signature Date

Program Implementation Student’s engagement


Correctness and Presentation in practical activities Total
(4) Methodology (3) (3) (10)
R1 R2 R3

42 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Practical No.8: Form Handling


a. Create student registration form using text box, check box, radio button, select, submit
button. And display user inserted value in new PHP page using GET or POST Method.
b. Write a PHP script to explain the concept of $_REQUEST.

A) Create student registration form using text box, check box, radio button, select,
submit button. And display user inserted value in new PHP page using GET or POST
Method.

Input :

43 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Output :

44 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

B) Write a PHP script to explain the concept of $_REQUEST.

Input:

45 | P a g e 226170316092
PHP (4341604) SEM 4(IT) Batch: B1

Output:

Assessment-Rubrics
Faculty
Marks Obtained Signature Date

Program Implementation Student’s engagement


Correctness and Presentation in practical activities Total
(4) Methodology (3) (3) (10)
R1 R2 R3

46 | P a g e 226170316092

You might also like