Bird
0
0

What will this PHP code output?

medium📝 Predict Output Q5 of 15
PHP - Superglobals and Web Context
What will this PHP code output?
$input = "Hello";
$sanitized = strip_tags($input);
echo $sanitized;
A<b>Hello</b>
B<b>Hello</b>
CHello
DError: filter_var not found
Step-by-Step Solution
Solution:
  1. Step 1: Understand strip_tags effect

    strip_tags removes HTML tags from the string, so "Hello" becomes "Hello".
  2. Step 2: Output the sanitized string

    echo prints "Hello" without tags.
  3. Final Answer:

    Hello -> Option C
  4. Quick Check:

    strip_tags removes HTML tags [OK]
Quick Trick: strip_tags() strips HTML tags [OK]
Common Mistakes:
  • Expecting tags to remain
  • Confusing with htmlspecialchars output
  • Assuming error from filter_var

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes