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

PHP中常量的定义

WBOY
WBOYOriginal
2016-06-13 10:44:02966browse

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