<?php
define("PI",3.1415926); //定义常量
$r=12;//定义圆半径
echo "半径为12的单位的圆的面积".PI*($r*$r);//定义面积
?>In PHP, the define() function is usually used to define constants, the constant() function is used to dynamically obtain the constant value, the defined() function is used to determine whether a constant has been defined, and the get_defined_constant() function is used to obtain all currently defined constants.
The syntax of the define() function to define constants is as follows:
bool define(string name,mixed value,[,bool case_insensitive]);
Parameter description
string name required parameter, constant name, i.e. identifier
mixed value required parameter, constant value
bool case_insensitive optional parameter, specifies that the case is sensitive, set to true, indicating sensitivity