Are php class names case sensitive?

(*-*)浩
Release: 2023-02-24 06:16:02
Original
3973 people have browsed it

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; //无输出
Copy after login

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
Copy after login

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";
 }
Copy after login

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
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template