Home  >  Article  >  Backend Development  >  Definition of constants in PHP_PHP tutorial

Definition of constants in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:45:30775browse

1. Custom constants
* Must be defined using function define()
* Its value cannot be changed after it is defined
* Use the constant name directly when using it. You cannot add $s
in front like a variable. For example: define("PI",3.14); define a constant
$area = PI*R*R; Calculate the area of ​​the circle
        define("URL","http://www.ybldcc.com");
echo "My URL is: ".URL;
2 System constants:
FILE:php program file name
LINE: Number of lines of PHP program file
PHP_VERSION: The version number of the current parser
PHP_OS: The name of the operating system that executes the current PHP version
Author “ITeamsky-Yang Bo’s Technology Space”

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478666.htmlTechArticle1. Custom constants* must be defined using the function define()* and their values ​​cannot be changed after definition* When using it, use the constant name directly. You cannot add $s in front like a variable. For example: define(PI,3.14...
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