Home  >  Article  >  Backend Development  >  Are php class names case sensitive?

Are php class names case sensitive?

(*-*)浩
(*-*)浩Original
2019-09-12 14:48:353957browse

PHP's handling of case-sensitive issues is messy, and problems may occasionally occur when writing code, so I'll summarize it here.

But I am not encouraging everyone to use these rules. It is recommended that everyone always adhere to "case sensitivity" and follow unified coding standards.

Are php class names case sensitive?

Variable names are case-sensitive (Recommended learning: PHP programming from entry to proficiency)

 <?php
 $abc = &#39;abcd&#39;;
 echo $abc; //输出 &#39;abcd&#39;
 echo $aBc; //无输出
 echo $ABC; //无输出

Constant names are case-sensitive by default and are usually written in uppercase

<?php
 define("ABC","Hello World");
 echo ABC; //输出 Hello World
 echo abc; //输出 abc

php.ini configuration item instructions are case-sensitive

such as file_uploads = 1 cannot be written as File_uploads = 1

Function names, method names, and class names are not case-sensitive

But it is recommended to use the same name as when defined

 <?php
 function show(){
 echo "Hello World";
 }

Magic constants are not case-sensitive, uppercase letters are recommended

Including: __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, __NAMESPACE__.

<?php
 echo __line__; //输出 2
 echo __LINE__; //输出 3

The above is the detailed content of Are php class names case sensitive?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What is php micro engineNext article:What is php micro engine