Home > Backend Development > PHP Tutorial > PHP defines constants, the difference between const and define

PHP defines constants, the difference between const and define

WBOY
Release: 2016-07-28 08:29:39
Original
1042 people have browsed it

  • const can be used in a class, but define cannot.
  • const defines class member variables in a class. Once defined, it cannot be changed. define can only define global constants, not class member variables
  • const can only be named with ordinary constants, define can use expressions
  • const can only receive static variables, define can receive any expression
  • const is case-sensitive when defining constants Sensitive, define can specify whether it is case sensitive through the third parameter (true means case is not sensitive)
  • const cannot define variables in conditional statements

 PHP定义常量是,const和define的区别

').addClass('pre- numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the difference between PHP defined constants, const and define, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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