PHP Practical File

Download as pdf or txt
Download as pdf or txt
You are on page 1of 45

WBP PRACTICALS

1. Write regular expressions including modifiers, operators, and metacharacters.

SOURCE CODE:

OUTPUT:
2. Write a program to show the usage of nested if statement.

SOURCE CODE:

OUTPUT:
3. Write a Program in PHP for type Casting Of Variables.

⚫ Type Casting into string

OUTPUT:
⚫ Typecasting into Integer.

OUTPUT:
⚫ Typecasting into Float.

SOURCE CODE:

OUTPUT:
4. Write a program to create a menu driven program and show the usage ofswitch-case.

SOURCE CODE:

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

i. For Loop

SOURCE CODE:

OUTPUT:
ii. While Loop

SOURCE CODE:

OUTPUT:

iii. Do While Loop

SOURCE CODE:
OUTPUT:
6. Write a program to perform all four types of sorting.

i. Insertion Sort

SOURCE CODE:

OUTPUT:
ii. Selection Sort

SOURCE CODE:

OUTPUT:
iii. Bubble Sort

SOURCE CODE:

OUTPUT:
iv. Merge Sort

SOURCE CODE:

OUTPUT:
7. Write a program to implement Array-pad(),aaray_slice(),array_splice(),list() functions.

i. Array-Pad()

SOURCE CODE:

OUTPUT:
ii. Array-Slice ()

SOURCE CODE:

OUTPUT:
iii. Array-Splice ()

SOURCE CODE:

OUTPUT:
iv. List ()

SOURCE CODE:

OUTPUT:
8. Write a program to show the application of user defined functions.

SOURCE CODE:

OUTPUT:
9. Write a program that Passes control to another page (include, require, exit and die functions).

SOURCE CODE:

1. Include and require functions()

2. Exit()

3. Die()

OUTPUT:

1. Include and require functions()

2. Exit()

3. Die()
10. Write a program to validate the form data using Filter_var() function.

SOURCE CODE:
OUTPUT:
11. Write a program to show the usage of Cookie.

SOURCE CODE:

1. cookie.php()

2. Cookie2.php()
3. Cookie3.php()

OUTPUT:

1. Cookie.php()

2. Cookie2.php()

3. Cookie3.php()
12. Write a program to show the usage of Session

SOURCE CODE:

OUTPUT:
13. Write a program to implement oops concepts.

SOURCE CODE:

OUTPUT:
14. Do Form handling In PHP Design a personal Information form , then Submit & Retrieve
the Form Data Using $_GET(), $_POST() and $_REQUEST() Variables.

SOURCE CODE:

1. Admin.php() using Post method


2. Admin.php() using Get method:

OUTPUT:

1. Admin.php() using Post method

2. Admin.php() using Get method


15. Design A Login Form and Validate that Form using PHP Programming.

SOURCE CODE:
OUTPUT:
16. Create Admin Login ,Logout form using session variables.

SOURCE CODE:

Login.php()

Admin.php()

OUTPUT:
17. Write a program to create a file.

SOURCE CODE:

OUTPUT:
18. Write a program that use various PHP library functions, and that manipulate files and
directories.

SOURCE CODE:
OUTPUT:
19. Write a program to read and display the content of previously created file.

SOURCE CODE:

Example.txt

Demo.php

OUTPUT:
20. Write a program to modify the content of an existing file.

SOURCE CODE:

OUTPUT:
21. Create a web page and which provides File uploading and downloading a file.

SOURCE CODE:

OUTPUT:
22. Design a from which upload And Display Image in PHP.

SOURCE CODE:

Upload_display_image.php

Upload_image.php
OUTPUT:
23. Write a program to create a mysql database.

SOURCE CODE:

OUTPUT:
24. Write a program to create a table and insert few records into it using form.

SOURCE CODE:

Create_table_form.php

Create_table_insert_records.php
OUTPUT:
25. Write a program to select all the records and display it in table.

SOURCE CODE:
26. Write a program to create a table and insert few records into it using form.

SOURCE CODE:
27. Write a PHP script, to check whether the page is called from 'https' or 'http'.

SOURCE CODE:

OUTPUT:

You might also like