Is PHP a case sensitive language?

Partly. In PHP, variable names are case-sensitive, but function names, class names and keywords are not.

Case-sensitiveNot case-sensitive
Variable names ($name and $Name are different)Keywords like echo, if, while, function
Constants (created with define or const)Function names (sum() and SUM() are same)
Array keys (“Name” and “name” are different)Class names and method names
<?php
$name = "James";

ECHO $name . "<br>";     // keywords are not case-sensitive

function sum() {
    return "Function called";
}

echo SUM();              // same as sum()
?>

Output:

Tutorials Class - Output Window

James
Function called

If you write echo $NAME;, PHP shows a warning “Undefined variable $NAME”, because it is a different variable.

Note: Even if PHP allows it, write function and class names in the same case as they were created. It keeps the code clean. See PHP Syntax.

Learn more about the similar topics:
Tutorials
PHP Variables
Exercises & Assignments
Write a program to print “Hello World” using echo
Write a program to print “Hello PHP” using variable
Write a program to print a string using echo+variable.
Write a program to print two variables in single echo
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?
What is the difference between $var and $$var in PHP?
Which special characters are allowed in PHP variable names?
Can we print multiple variables in a single echo statement in PHP?
How to check the data type of a variable in PHP?