PHP基本类型测试
2009-04-21 11:46
323 查看
源代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/xhtml1-loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title goes here</title>
</head>
<body>
<?php
$bool = TRUE;
echo "value=$bool, type=";
echo gettype($bool);
?>
<br />
<?php
$int = 1;
echo "value=$int, type=";
echo gettype($int);
?>
<br />
<?php
$double = 1.0;
echo "value=$double, type=";
echo gettype($double);
?>
<br />
<?php
$string = "This is a string";
echo "value=$string, type=";
echo gettype($string);
?>
</body>
</html>
输出:
value=1, type=boolean
value=1, type=integer
value=1, type=double
value=This is a string, type=string
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/xhtml1-loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title goes here</title>
</head>
<body>
<?php
$bool = TRUE;
echo "value=$bool, type=";
echo gettype($bool);
?>
<br />
<?php
$int = 1;
echo "value=$int, type=";
echo gettype($int);
?>
<br />
<?php
$double = 1.0;
echo "value=$double, type=";
echo gettype($double);
?>
<br />
<?php
$string = "This is a string";
echo "value=$string, type=";
echo gettype($string);
?>
</body>
</html>
输出:
value=1, type=boolean
value=1, type=integer
value=1, type=double
value=This is a string, type=string
相关文章推荐
- PHP 八种基本的数据类型小结
- PHP第三个教训 PHP基本数据类型
- PHP 八种基本的数据类型
- PHP 函数传递基本数据类型和数组的内存传递方式
- 1.php 入门软件配置,基本的数据类型
- PHP的基本语法和数据类型
- lua和php的基本数据类型
- PHP 八种基本的数据类型小结
- php基本语法和数据类型、变量销毁
- php的基本数据类型
- PHP面向对象中类方法的两种类型:1、基本类型
- java八大基本数据类型测试总结
- PHP 八种基本的数据类型
- php 基本数据类型
- Android基本数据类型测试
- php常量,预定义常量,魔术常量及基本数据类型
- C/C++基本数据类型(带测试程序)
- Java基本数据类型测试
- 5. php 基本数据类型
- PHP基本类型操作