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<code><script></code>
B<code><php></code>
C<code><?></code>
D<code><?php</code>
Step-by-Step Solution
Solution:
  1. Step 1: Identify the PHP opening tag

    PHP scripts start with <?php to tell the server to process PHP code.
  2. Step 2: Check other options

    <php> and <?> are invalid tags. <script> is for JavaScript, not PHP.
  3. Final Answer:

    <?php -> Option D
  4. Quick Check:

    PHP starts with <?php [OK]
Quick Trick: PHP always starts with <?php tag [OK]
Common Mistakes:
  • Using <php> instead of <?php
  • Confusing PHP tags with HTML or JavaScript tags
  • Omitting the PHP start tag

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes