Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction of constant and usage of system constant in PHP

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the knowledge of "introduction to constants and usage of system constants in PHP". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

PHP constants default to case sensitivity. Traditionally, constant identifiers are always capitalized.

PHP constant names follow the same naming convention as any other PHP tag. Legal constant names begin with a letter or underscore, followed by any letter, number, or underscore. The regular expression is expressed like this: [a murzAmurz Z _\ x7f -\ xff] [a-zA-Z0-9 _\ x7f -\ xff] *.

The copy code is as follows:

Summary:

1. Custom constant

* must be defined with the function define ()

* the value cannot be changed after the definition.

* use a constant name directly instead of adding $s in front of it like a variable

2 system constant:

FILE: php program file name

LINE: number of lines of PHP program files

PHP_VERSION: version number of the current parser

PHP_OS: the name of the operating system executing the current version of PHP

The name of the script file that FILE__ is currently working on.

The current number of lines of the script file currently being processed by _ _ LINE__, as before.

TRUE represents true value (true).

FALSE represents a pseudo value (false).

The constant E_ERROR refers to the most recent error.

The quantity E_WARNING points to the most recent warning.

The E_PARSE constant is a potential problem with parsing syntax.

That's all for the introduction of "introduction to constants and usage of system constants in PHP". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report