Home > Backend Development > PHP Tutorial > Definition of constants in PHP_PHP tutorial

Definition of constants in PHP_PHP tutorial

WBOY
Release: 2016-07-13 17:45:30
Original
805 people have browsed it

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