首页 > 代码库 > 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>

PHP学习笔记之显示数组与对象示例