Home > php教程 > php手册 > PHP中常量的定义

PHP中常量的定义

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:44:02
Original
1020 people have browsed it

1.自定义常量
  * 必须用函数define()定义
  * 定义完后其值不能再改变了
  * 使用时直接用常量名,不能像变量一样在前面加$s
 例如:define("PI",3.14);定义一个常量
      $area = PI*R*R; 计算圆的面积
      define("URL","http://www.ybldcc.com");
      echo "我的网址是:".URL;
2 系统常量:
  FILE :php程序文件名
  LINE :PHP程序文件行数
  PHP_VERSION:当前解析器的版本号
  PHP_OS:执行当前PHP版本的操作系统名称
作者 “ITeamsky-杨波的技术空间”

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template