All variables in PHP start with which symbol?

  1. $

  2. !

  3. %

  4. #


Correct Option: A

AI Explanation

To answer this question, you need to understand the basic syntax of PHP.

Option A) $ - This option is correct because in PHP, all variables start with the dollar sign ($) symbol. This symbol is used to declare and access variables in PHP.

Option B) ! - This option is incorrect because the exclamation mark (!) is not used to declare or access variables in PHP. It is used for logical negation or as part of comparison operators.

Option C) % - This option is incorrect because the percentage symbol (%) is not used to declare or access variables in PHP. It is used for the modulo operation or as part of format specifiers in functions like printf().

Option D) # - This option is incorrect because the hash symbol (#) is not used to declare or access variables in PHP. It is commonly used for single-line comments in PHP code.

The correct answer is A) $. This option is correct because all variables in PHP start with the dollar sign ($) symbol.

Find more quizzes: