Case Sensitivity In PHP

If you are the PHP developer, then, you might argue about the case sensitivity in the PHP programming language. So, you searched for it, and accidentally landed to this site. Well, you have landed to the right place. Here, we will describe about the case sensitivity applied to the PHP programming language.

You can write the PHP variable as well as the functions as you like while you are building your PHP projects to make it more easy to complete those. But, you might be in dilemma about the PHP case sensitivity about what will work out and which one does not at all. So, in order to help you, we’ve created a case sensitivity example for the PHP programming language. Well, for the information on this, the case sensitivity in PHP is applied in all the variables, while it is not applicable for all user-defined functions, classes and keywords(for eg. if, else, while, foreach, echo, etc). The example for this is given below:

<!DOCTYPE html>
<meta charset="UTF-8">
<title>Case Sensitivity In PHP</title>
ECHO "Hello World!<br>"; // The keyword ECHO is used here and is not case sensitive.
echo "Hello World!<br>";

echo "<hr>";
$a = "Hello World!";
If (!isset($a)) {
echo "name is not set";
} else {
echo $a . "<br>";
} // The keyword If is used here and is not case sensitive.

echo "<hr>";

function my_function() {
echo "Hello World!<br>";

My_function(); // Case sensitivity is not affecting the user-defined declared function here.
// Variable has the case sensitivity applied to it.
$color = "red"; // This variable has "red" value.
$COLOR = "blue"; // This variable has "blue" value.
echo "My book colour is " . $color . ".<br>";
echo "My bed colour is " . $COLOR . ".<br>";

The image shown above is the result of the PHP code provided above when it is executed. Here, you can see that there is no case sensitivity effect for the PHP keywords as well as the user-defined functions, while in the case of variable, there is the effect of the PHP case sensitivity, as seen in the first, second, third and fourth result respectively.

Now, we can assume that, if you have followed the above example properly, then, you now know about the PHP case sensitivity. So, after learning about this, do not get confuse on the PHP case sensitivity and complete your PHP project as fast as possible without any confusion.

Post navigation

Bishal Napit

Bishal Napit is a WordPress theme developer from Tansen, Palpa, with a passion to learn more on WordPress.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.