是什么意思 [] [英] What is the meaning of []

查看:108
本文介绍了是什么意思 []的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有下面的代码,我不确定$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:

警告:不能在第4行的test.php中将标量值用作数组

Warning: Cannot use a scalar value as an array in test.php on line 4

这篇关于是什么意思 []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆