Bird
0
0

Which of the following is the correct way to start a PHP script?

easy📝 Syntax Q12 of 15
PHP - Basics and Execution Model
Which of the following is the correct way to start a PHP script?
A<script>echo 'Hello';</script>
B<php echo 'Hello'; ?>
C<? echo 'Hello'; ?>
D<?php echo 'Hello'; ?>
Step-by-Step Solution
Solution:
  1. Step 1: Recall PHP opening tags

    The standard way to start PHP code is with tags.
  2. Step 2: Check each option

    uses the correct full opening tag. misses the question mark. uses short tags which may not be enabled. is JavaScript, not PHP.
  3. Final Answer:

    -> Option D
  4. Quick Check:

    Standard PHP tag = D [OK]
Quick Trick: Use
Common Mistakes:
  • Using
  • Relying on short tags which may be disabled
  • Confusing PHP with JavaScript tags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes