Why does PHP require a dollar sign ($) before variable names?
hard📝 Conceptual Q10 of 15
PHP - Variables and Data Types
Why does PHP require a dollar sign ($) before variable names?
ATo indicate the variable type explicitly
BTo mark variables as global only
CTo distinguish variables from constants and keywords
DTo make variable names case-insensitive
Step-by-Step Solution
Solution:
Step 1: Understand PHP variable syntax purpose
The $ sign helps PHP identify variables clearly, separating them from constants, functions, and keywords.
Step 2: Analyze options
Only To distinguish variables from constants and keywords correctly explains the purpose of the $ sign. PHP does not use $ to indicate type, scope, or case sensitivity.
Final Answer:
To distinguish variables from constants and keywords -> Option C
Quick Check:
$ sign purpose = distinguish variables [OK]
Quick Trick:Dollar sign marks variables, not types or scope [OK]
Common Mistakes:
Thinking $ shows type
Assuming $ means global
Believing $ affects case sensitivity
Master "Variables and Data Types" in PHP
9 interactive learning modes - each teaches the same concept differently