问题描述
我有下面的代码,我不确定$ACTIVITYGROUPS[]
具有什么类型的数据变量以及如何读取它?
I have a code as below and I am not sure what type of data variable $ACTIVITYGROUPS[]
has and how do I read it ?
$ACTIVITYGROUPS[] = saprfc_table_read ($fce, "ACTIVITYGROUPS", $i);
当我做print_r(saprfc_table_read ($fce, "ACTIVITYGROUPS", $i);
时,我得到了一堆没有任何分隔符的数组,并且不确定如何精确地处理数据.有人可以告诉我上面的句子是做什么的吗?
When I did print_r(saprfc_table_read ($fce, "ACTIVITYGROUPS", $i);
I got bunch of arrays without any seperator and not sure how to exactract the data. can someone tell me what does it do in above sentences ?
这是print_r(saprfc_table_read ($fce, "ACTIVITYGROUPS", $i);
结果给我的:
Array (
[AGR_NAME] => Y:SECURITY_DISPLAY
[FROM_DAT] => 20080813
[TO_DAT] => 99991231
[AGR_TEXT] => Security Display - Users & Roles
[ORG_FLAG] => C
)
Array (
[AGR_NAME] => Y:SECURITY_ADMIN_COMMON
[FROM_DAT] => 20080813
[TO_DAT] => 99991231
[AGR_TEXT] => Security Administrator
[ORG_FLAG] => C
)
Array (
[AGR_NAME] => Y:LOCAL_TRANSPORT
[FROM_DAT] => 20090810
[TO_DAT] => 99991231
[AGR_TEXT] => Transport into target client - DEV system only
[ORG_FLAG] =>
)
推荐答案
[]
表示 push -将给定的参数作为新元素放在数组的末尾.这意味着$ACTIVITYGROUPS
是一个数组*.
[]
means push - put the given argument as a new element on the end of the array. That means that $ACTIVITYGROUPS
is an array*.
$arr = array();
$arr[] = 1; // Put 1 in position 0
$arr[] = "a"; // Put "a" in position 1
$arr[] = array() // Put a new, empty array in position 2
如PHP文档所述, array_push
与.
As stated by the PHP docs, array_push
has the same effect as []
.
* 如果不是数组,则使用[]
会出现语法错误:
* If it's not an array, using []
will give you a syntax error:
这篇关于是什么意思 []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!