首页 > 代码库 > PHP学习笔记之显示数组与对象示例
PHP学习笔记之显示数组与对象示例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>显示数组与对象</title>
</head>
<body>
<?php
$a = array(1, 2, array("aa", "bb", "cc"));
echo $a; echo "<hr />";
print_r($a); echo "<hr />";
var_dump($a); echo "<hr />";
var_export($a); echo "<hr />";
$b = var_export($a, true);
echo $b; echo "<hr />";
print_r($b); echo "<hr />";
var_dump($b); echo "<hr />";
$c = array ( 0 => 1, 1 => 2, 2 => array ( 0 => ‘aa‘, 1 => ‘bb‘, 2 => ‘cc‘, ), );
echo $c; echo "<hr />";
print_r($c); echo "<hr />";
var_dump($c); echo "<hr />";
?>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>显示数组与对象</title>
</head>
<body>
<?php
$a = array(1, 2, array("aa", "bb", "cc"));
echo $a; echo "<hr />";
print_r($a); echo "<hr />";
var_dump($a); echo "<hr />";
var_export($a); echo "<hr />";
$b = var_export($a, true);
echo $b; echo "<hr />";
print_r($b); echo "<hr />";
var_dump($b); echo "<hr />";
$c = array ( 0 => 1, 1 => 2, 2 => array ( 0 => ‘aa‘, 1 => ‘bb‘, 2 => ‘cc‘, ), );
echo $c; echo "<hr />";
print_r($c); echo "<hr />";
var_dump($c); echo "<hr />";
?>
</body>
</html>
PHP学习笔记之显示数组与对象示例
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。