首页
IT
登录
6mi
u
盘
搜
搜 索
IT
PHP入门1.3
PHP入门1.3
xiaoxiao
2026-09-26
13
常量的定义 Example:
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
/>
<
title
>
Hello Php
</
title
>
</
head
>
<
body
>
<?php
/* 常量4种类型:int、float、String、bool 常量 define有三个参数 第三个参数决定常量是否严格区分大小写 */
define(
"ENGINEERZHONG"
,
520
);
//定义一个常量名为 EngineerZhong 值为 520(int)
echo
ENGINEERZHONG;
echo
"<br>"
; define(
"ENGINEERZHONG2"
,
521
,
true
);
echo
engineerzhong2; define(
"INT"
,
100
);
//int 类型常量
define(
"STRING"
,
"Hello"
);
//String 类型常量
define(
"FLOAT"
,
5.20
);
//Float 类型常量
define(
"BOOL"
,
'false'
);
//Bool 类型常量,常量值使用 单引号
echo
"<br>"
;
echo
INT;
echo
"<br>"
;
echo
STRING;
echo
"<br>"
;
echo
FLOAT;
echo
"<br>"
;
echo
BOOL;
?>
</
body
>
</
html
>
更新时间
:2016
年8月16日
转载请注明原文地址: https://ju.6miu.com/read-1312353.html
最新回复
(
0
)