Bird
0
0

What will be the output of running this PHP script?

medium📝 Predict Output Q4 of 15
PHP - Basics and Execution Model
What will be the output of running this PHP script?
<?php
echo PHP_VERSION;
?>
APHP_VERSION
BThe current PHP version number installed
CAn error about undefined constant
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Understand PHP_VERSION constant

    PHP_VERSION is a predefined constant that holds the current PHP version as a string.
  2. Step 2: Output of echo PHP_VERSION

    Echoing PHP_VERSION prints the installed PHP version number, like '8.1.10'.
  3. Final Answer:

    The current PHP version number installed -> Option B
  4. Quick Check:

    PHP_VERSION constant outputs version number [OK]
Quick Trick: PHP_VERSION constant shows installed PHP version [OK]
Common Mistakes:
  • Thinking PHP_VERSION is a string literal
  • Expecting no output or error
  • Confusing constant with variable

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes