PHP Practice Questions

The following PHP Practice Questions help you gain expertise in PHP language.

  1. Write regular expressions including modifier operators and metacharacters.
  2. Create a program to show the usage of the nested if statement.
  3. Develop a Program in PHP for type Casting of Variables
  4. Create a PHP application to show the usage of the switch-case statement.
  5. Write a program to show the usage of for/while /do-while loop in PHP
  6. When to use a static variable in a function in PHP? Give an example.
  7. Create a menu-driven program to perform all four types of sorting – Bubble Sort, Insertion Sort, Selection Sort, and Merge Sort
  8. Write a program to implement array_pad(), array_slice(), array_splice (), list() functions.(use foreach wherever applicable)
  9. Create a program to show the application of user-defined functions.
  10. Write a program that Passes control to another page (include, require, exit, and die functions)
  11. Create a program to validate the form data using the filter_var() function.
  12. How to create a simple cookies in PHP that stores a string?
  13. Create a cookie with data containing multiple fields.
  14. How to create a cookie that stores user’s name and age.
  15. Write a program to show the usage of Cookies in PHP.
  16. Create a program to show the usage of Session
  17. Write a program to implement oops concepts in PHP.
  18. Do Form handling In PHP. Design a personal Information form , then Submit & Retrieve the Form Data Using $_GET(), $_POST() and$_REQUEST() Variables.
  19. Design A Login Form and Validate that Form using PHP Programming
  20. Create Admin Login and Logout form using session variables
  21. Write a program to create a file.
  22. Differentiate between w and w+ modes for creating a file.
  23. Differentiate between a and a+ modes for creating a file.
  24. Create a program that uses various PHP library functions, and that manipulates files and directories.
  25. Write a program to read and display the content of the previously created file.
  26. Create a program in PHP that counts the number of lines in a text file. Also, display each line with a line number.
  27. Develop a program to modify the content of an existing file.
  28. Create a web page that provides File uploading and downloading a file.
  29. Design a from which uploads And Display Image in PHP

Advanced PHP Practice Questions

  1. Use phpMyAdmin and perform the following: import, review data and structure, run SQL statements,  create users and privileges
  2. Write a program to create a MySQL database.
  3. Develop a program to create a table and insert a few records into it using the form.
  4. Write a program to select all the records and display them in a table.
  5. Create a program to modify (delete/modify/add) a table.
  6. Write a PHP script, to check whether the page is called from ‘https’ or ‘http’.
  7. Develop a program to verify text data as per the pattern.
  8. Create a dynamic website by incorporating the following functionalities:
  • 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 applications using PHP & MySQL
  • ¬∑Perform some validation checks. If any of these operations cause an error, stop execution and print the error message. The script s hould respond differently depending on the situation.

Add a “Log Out” button to logout from the system

Further Reading

10+ File Handling Problems in PHP

Pattern Display Problems in PHP

How to Create a Login Application in PHP?

How to Implement the Change Password Function in PHP?

Examples of Array Functions in PHP

Basic Programs in PHP

Registration Form Using PDO in PHP

Inserting Information from Multiple CheckBox Selection in a Database Table in PHP

PHP Projects for Undergraduate Students

Architectural Constraints of REST API

REST API Concepts

Creating a Classified Ads Application in PHP


You may also like...