PHP多维数组

本文概述

PHP多维数组也称为数组数组。它允许你将表格数据存储在数组中。 PHP多维数组可以用行*列表示的矩阵形式表示。

定义

$emp = array
  (
  array(1, "sonoo", 400000), array(2, "john", 500000), array(3, "rahul", 300000)
  );

PHP多维数组示例

让我们看一个简单的PHP多维数组示例, 以显示以下表格数据。在此示例中, 我们显示3行3列。

Id Name Salary
1 sonoo 400000
2 john 500000
3 rahul 300000

档案:multiarray.php

<?php  
$emp = array
  (
  array(1, "sonoo", 400000), array(2, "john", 500000), array(3, "rahul", 300000)
  );

for ($row = 0; $row < 3; $row++) {
  for ($col = 0; $col < 3; $col++) {
    echo $emp[$row][$col]."  ";
  }
  echo "<br/>";
}
?>

输出

1 sonoo 400000 
2 john 500000 
3 rahul 300000

来源:

https://www.srcmini02.com/29246.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37992.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?