我有一个代码如下,我不知道什么类型的数据变量$ACTIVITYGROUPS []有,我怎么读它?
$ACTIVITYGROUPS[] = saprfc_table_read ($fce,"ACTIVITYGROUPS",$i);
当我做print_r(saprfc_table_read($fce,“ACTIVITYGROUPS”,$i);我得到了一堆没有任何分隔符的数组,不知道如何精确数据.有人可以告诉我它在上面的句子中做了什么?
这是print_r(saprfc_table_read($fce,$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是一个数组*.
$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
与[]具有相同的效果.
*如果它不是数组,使用[]将给出语法错误:
Warning: Cannot use a scalar value as an array in test.PHP on line 4