相关疑难解决方法(0)

Reference — What does this symbol mean in PHP?

What is this?

This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.

Why is this?

It used to be hard to find questions about operators and other syntax tokens.¹
The main idea is to have links to existing questions on Stack Overflow, so it's easier for us to reference them, not to copy over content from …

php arguments symbols operators

4314
推荐指数
21
解决办法
63万
查看次数

在PHP $ array [] = $ value或array_push($ array,$ value)中使用什么更好?

在PHP中使用什么更好的附加数组成员:

$array[] = $value;
Run Code Online (Sandbox Code Playgroud)

要么

array_push($array, $value);
Run Code Online (Sandbox Code Playgroud)

虽然手册说你最好避免函数调用,但我读$array[]的速度要慢得多array_push().有没有人有任何澄清或基准?

php arrays performance

103
推荐指数
5
解决办法
4万
查看次数

的意义是什么 []

我有一个如下代码,我不知道什么类型的数据变量$ACTIVITYGROUPS[]有什么,我怎么读它?

$ACTIVITYGROUPS[] = saprfc_table_read ($fce, "ACTIVITYGROUPS", $i);
Run Code Online (Sandbox Code Playgroud)

当我这样做时,print_r(saprfc_table_read ($fce, "ACTIVITYGROUPS", $i);我得到了一堆没有任何分隔符的数组,并且不确定如何精确数据.谁可以告诉我它在上面的句子中做了什么?

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 - …
Run Code Online (Sandbox Code Playgroud)

php arrays

8
推荐指数
1
解决办法
1万
查看次数

哪个更快$ variable []或array_push($ variable,$ newValue)?

将变量添加到数组时哪个更快?

  1. $ variable [] = $ newValue;
  2. array_push($变量$ NEWVALUE);

请注意两者之间的区别(如果有的话).

php arrays operators

5
推荐指数
2
解决办法
4198
查看次数

PHP:简单的数组操作

我有这样的数组(仅一维):

$arr = array('one', 'two', 'three', 'foo', 'bar', 'etc');

现在我需要一个for()创建新数组的循环$arr,如下所示:

$newArr = array('one', 'onetwo', 'onetwothree', 'onetwothreefoo', 'onetwothreefoobar', 'onetwothreefoobaretc');

似乎很简单,但我无法弄清楚.

提前致谢!

php arrays loops for-loop

1
推荐指数
1
解决办法
803
查看次数

标签 统计

php ×5

arrays ×4

operators ×2

arguments ×1

for-loop ×1

loops ×1

performance ×1

symbols ×1