Learn with Yasir
Share Your Feedback

PHP Basics Review Questions – Test and Strengthen Your PHP Knowledge


Review key PHP basics with these carefully crafted questions. Ideal for beginners, students, and interview preparation. Strengthen your core PHP skills today!

🔍 Review Questions

  1. What is the purpose of the `phpinfo()` function in PHP?

  2. Answer

    The `phpinfo()` function in PHP outputs a large amount of information about the current state of PHP, including loaded extensions, PHP version, server information, and environment variables. It is useful for debugging and checking the PHP configuration.


  3. How do you define a variable in PHP?

  4. Answer

    In PHP, a variable is defined by prefixing a dollar sign (`$`) to a name. For example, `$variableName = "value";` assigns the string "value" to the variable `variableName`.


  5. What does the `echo` statement do in PHP?

  6. Answer

    The `echo` statement in PHP is used to output one or more strings to the browser. It is commonly used to display content on web pages.


  7. Can PHP variables hold different data types?

  8. Answer

    Yes, PHP variables are dynamically typed, meaning they can hold different data types, such as integers, strings, arrays, and objects, without explicit type declaration.


  9. What is the difference between `include` and `require` in PHP?

  10. Answer

    Both `include` and `require` are used to include files in PHP scripts. The main difference is that if the file is not found, `include` will emit a warning and continue execution, while `require` will emit a fatal error and stop the script.



🧠 Practice & Progress

Explore More Topics

PHP Basics

More ...