Bird
0
0

Which keyword is used to declare a function in PHP?

easy📝 Conceptual Q2 of 15
PHP - Functions
Which keyword is used to declare a function in PHP?
Afunction
Bfunc
Cdef
Ddeclare
Step-by-Step Solution
Solution:
  1. Step 1: Recall PHP function declaration syntax

    PHP uses the keyword 'function' to declare functions.
  2. Step 2: Compare options

    Only 'function' is the correct PHP keyword; others belong to different languages or are invalid.
  3. Final Answer:

    function -> Option A
  4. Quick Check:

    Function keyword = function [OK]
Quick Trick: Use 'function' keyword to declare functions [OK]
Common Mistakes:
  • Using 'def' like Python
  • Using 'func' or 'declare' incorrectly
  • Omitting the keyword entirely

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes