: This article mainly introduces the difference between const and define in php (supplement). If you are interested in PHP tutorials, refer to it. A constant is the identifier (name) of a simple value ). As its name implies, this value cannot be
Const is used for the definition of class member constants. it cannot be modified after definition, and define is used to define global constants, so that we can access but cannot change it elsewhere, we will list the details below. note: define
Note: Define cannot be defined in a class, and the const must be defined in a class, and the const must be accessed by the class name:: Variable name
1. Const is used for class member variable definition once defined and cannot change its value.
Original address: http://www.manongjc.com/article/491.html
Const is the definition of a class member constant, which cannot be changed after the definition, and define we define global constants so that we can access them elsewhere but not change
A constant is an identifier (first name) of a simple value. As the name implies, the value cannot be changed during script execution (except for the so-called magic constants, they are not constants). Changshime is considered to be case sensitive.
Understanding # define sreg (* (volatile unsigned char *) 0x5f)
Understanding # define sreg (* (volatile unsigned char *) 0x5f)This definition is always very strange. I don't know why. I have a little bit of experience today. Please submit more
A constant is an identifier (first name) of a simple value. As the name implies, the value cannot be changed during script execution (except for the so-called magic constants, they are not constants). Changshime is considered to be case sensitive.
Parse the differences between const and define in php. 1. const is used for defining class member variables. once defined, the value cannot be changed. Define defines global constants that can be accessed anywhere. 2. define cannot be defined in the
Const and define all define constants in PHP, but what are their specific differences? In fact, very simple const is used for the definition of a class member variable, once defined and cannot change its value. Define defines a global constant that
1, static properties, static methodsIn object-oriented programming, we can not only access methods and properties through objects, but also access them through classes. Such methods and properties are static and must be declared with the static
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.