Learn with Yasir
Share Your Feedback

PHP Basics True or False Questions – Test Your Core PHP Knowledge


Boost your PHP skills with these essential true or false questions on PHP basics. Perfect for beginners and interview preparation. Test your knowledge now!.

🔍 True or False

🟢 Beginner

  1. A PHP script can be embedded within an HTML document.
  2. Answer

    ✅ True – PHP scripts can be embedded within an HTML file, allowing dynamic content to be generated and displayed on web pages.


  3. In PHP, variables are case-insensitive.
  4. Answer

    ❌ False – In PHP, variable names are case-sensitive. For example, `$Variable` and `$variable` would be treated as two different variables.


🟡 Intermediate

  1. The `phpinfo()` function is used to display the current status of a PHP script.
  2. Answer

    ✅ True – The `phpinfo()` function outputs information about PHP's configuration, loaded modules, and environment settings, which is useful for debugging and configuration checks.


  3. The `echo` statement in PHP is used to terminate a script.
  4. Answer

    ❌ False – The `echo` statement in PHP is used to output data to the browser, not to terminate a script. To terminate a script, the `exit()` or `die()` functions are used.


🔴 Advanced

  1. A PHP script must always have a `.php` extension.
  2. Answer

    ✅ True – PHP scripts must have a `.php` extension in order to be processed by the PHP engine. Files with this extension are interpreted as PHP scripts by the server.


📚 Related Resources


🧠 Practice & Progress