Is PHP a case sensitive language?
In PHP, variable names are case-sensitive but function names are not case sensitive.
Explanation:
- If you defined variable in lowercase, then you need to use it in lowercase everywhere in the program. If we define a variable
$name = "James";then we must need to use $name. $NAME will not work
- If you defined function name in lowercase, but calling them in uppercase it will work. For example, If we define
function sum() {}then calling SUM() will also work.
Note:
Function names are case-insensitive, though it is good to call functions in the same case as they appear in their declaration for consistency.
Learn more about the similar topics:
| Tutorials |
|---|
| PHP Variables |
| Interview Questions & Answers |
|---|
| How to check if a variable is empty in PHP? |
| Is PHP a case sensitive language? |
| What are the different data types in PHP? |