相关疑难解决方法(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 var_dump()值显示每个值一行

当我回显var_dump($ _ variable)时,我得到一条长的包装线,包含所有的varable和值

["kt_login_user"]=>  string(8) "teacher1" ["kt_login_id"]=>  string(3) "973" ["kt_campusID"]=>  string(4) "9088" ["kt_positionID"]=>  string(1) "5" 
Run Code Online (Sandbox Code Playgroud)

有没有办法让每个值都显示在自己的行上以便于阅读?像这样的东西:

["kt_login_user"]=>  string(8) "teacher1" 
["kt_login_id"]=>  string(3) "973" 
["kt_campusID"]=>  string(4) "9088" 
["kt_positionID"]=>  string(1) "5"
Run Code Online (Sandbox Code Playgroud)

php var-dump line

62
推荐指数
9
解决办法
10万
查看次数

PHP字符串连接使用","?

我刚发现了一些东西.

echo $var1 , " and " , $var2;
Run Code Online (Sandbox Code Playgroud)

是相同的:

echo $var1 . " and " . $var2;
Run Code Online (Sandbox Code Playgroud)

什么是PHP中的实际字符串连接运算符?我应该使用.还是,

php string concatenation string-concatenation

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

连接字符串或使用多个回显参数:哪个更快?

假设我有两个 PHP 语句:

echo "foo"."bar"

echo "foo", "bar"
Run Code Online (Sandbox Code Playgroud)

请注意连接字符串的不同方式 - 使用 a.或 a ,

我意识到这两种方法之间的实际差异, using,为关键字提供了多个参数echo,而 using.实际上在 ing 之前将字符串连接在一起echo

但我的问题是,哪种方式更快?

php string performance concatenation string-concatenation

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

为什么html br break行标记在这段代码中不起作用?

有人可以告诉我为什么我的php行不能正常工作(回声)?

我知道我可以用不同的方式编写代码来使换行工作,但我想知道这背后的原因吗?

<?php

    $var1 = 3;

    echo "Addition = "       . $var1 += 3 . "<br>";
    echo "Subtraction = "    . $var1 -= 3 . "<br>";
    echo "Multiplication = " . $var1 *= 3 . "<br>";
    echo "Division = "       . $var1 /= 3 . "<br>";

?>
Run Code Online (Sandbox Code Playgroud)

html php operator-precedence

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

PHP中变量括号的内容是什么?

我在旧平台上使用PHP 5.3中的ImageMagick.我偶然发现了一段代码,这些代码在变量周围使用圆括号时无效,但在删除这些括号时确实有效.变量周围的括号有什么作用?

$im = new imagick();
$im->readImageBlob($photo);
$im->setImageFormat('jpg');
$photo = ($im);
Run Code Online (Sandbox Code Playgroud)

它没有用这段代码读取图像数据,但是当我删除括号时它就这样做了.

$photo = $im;
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

php variables parentheses

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