我对php如何处理数组并不是很熟悉,在.NET中我可以使用这种方法访问数组
array[x][y];
我的问题是:
我正在从数据库中检索记录并将其返回到$res_merchant_field
$res_merchant_field = $this->CI->merchantfield_model->merchantfield_list( $str_where );
并将$res_merchant_field
填充此记录:
Array
(
[0] => stdClass Object
(
[MFID] => 1
[MFName] => Bill No
[FTID] => 1
[DTID] => 1
[MFRequired] => 1
[MFDefaultValue] =>
[MFDueDate] => 0
[MFToBePaid] => 0
[MFMaxLength] => 12
[MFOrderNo] => 1
[MFStatus] => 1
)
[1] => stdClass Object
(
[MFID] => 2
[MFName] => Gallons Consumed
[FTID] => 1
[DTID] => 2
[MFRequired] => 1
[MFDefaultValue] =>
[MFDueDate] => 0
[MFToBePaid] => 0
[MFMaxLength] => 5
[MFOrderNo] => 2
[MFStatus] => 1
)
[2] => stdClass Object
(
[MFID] => 3
[MFName] => Amount Due
[FTID] => 3
[DTID] => 1
[MFRequired] => 1
[MFDefaultValue] =>
[MFDueDate] => 0
[MFToBePaid] => 1
[MFMaxLength] => 15
[MFOrderNo] => 3
[MFStatus] => 1
)
)
如何在此条件下访问并从该数组中获取记录:
- 它会查看所有数组找到特定的索引,比如说索引 0,它是 MFID,
- 在获得 MFID 并将其与另一个变量进行比较后,如果为真,
- 它将获得该阵列 MFID 的 DTID。
例子:
获得 MFID = 1,DTID 将为 1,如果我获得 MFID = 3,则 DTID 将为 1。
或者我怎样才能访问数组$array[x][y]
?
提前致谢。