php - 引用-这个符号在PHP中是什么意思?

标签 php arguments operators symbols

这是什么?

这是有关PHP语法的不时出现的问题的集合。这也是社区Wiki,因此邀请所有人参与维护此列表。

为什么是这样?

过去很难找到有关运算符和其他语法标记的问题。¹
主要思想是链接到Stack Overflow上的现有问题,因此我们更容易引用它们,而不必复制PHP手册中的内容。

注意:自2013年1月起,堆栈溢出does support special characters。只需用引号将搜索字词括起来,例如[php] "==" vs "==="

我该怎么办?

如果有人因提出这样的问题而将您指向此处,请在下面找到特定的语法。 PHP manual的链接页面以及链接的问题可能会回答您的问题。如果是这样,建议您增加答案。此列表不能代替其他人提供的帮助。

名单

如果您的特定令牌未在下面列出,则可以在List of Parser Tokens中找到它。



& Bitwise OperatorsReferences


What does it mean to start a PHP function with an ampersand?
Understanding PHP & (ampersand, bitwise and) operator
PHP "&" operator
Difference between & and && in PHP
What does "&" mean here in PHP?
What does "&" mean in this case?
What does the "&" sign mean in PHP?
What does this signature mean (&) in PHP?
How does the "&" operator work in a PHP function?
What does & in &2 mean in PHP?
When should I use a bitwise operator?
Is there ever a need to use ampersand in front of an object?(&$)




=& References


Reference assignment operator in PHP, =&
What do the "=&" and "&=" operators in PHP mean?
What do the '&=' and '=&' operators do?
What does =& mean in PHP?




&= Bitwise Operators


What do the "=&" and "&=" operators in PHP mean?
What do the '&=' and '=&' operators do?




&& Logical Operators


'AND' vs '&&' as operator
Difference between & and && in PHP
Is there any difference between "and" and "&&" operators in PHP?
PHP - and / or keywords




% Arithmetic Operators


What does the percent sign mean in PHP?
What is the PHP operator % and how do I use it in real-world examples?




!! Logical Operators


Double not (!!) operator in PHP




@ Error Control Operators


What is the use of the @ symbol in PHP?
'At' symbol before variable name in PHP: @$_POST
PHP functions and @functions
Should I use @ in my PHP code?
What does @ mean in PHP?




?: Ternary Operator


What are the PHP operators "?" and ":" called and what do they do?
?: operator (the 'Elvis operator') in PHP
Where can I read about conditionals done with "?" and ":" (colon)?
Using PHP 5.3 ?: operator




?? Null Coalesce Operator(自PHP 7起)


C#'s null coalescing operator (??) in PHP




?string
?int
?array
?bool
?float Nullable return type declaration(自PHP 7.1起)


Nullable return type declaration




: Alternative syntax for control structuresTernary Operator


What is ":" in PHP?
What does ":" mean in PHP?




:: Scope Resolution Operator


What do two colons mean in PHP?
What's the meaning of the PHP token name T_PAAMAYIM_NEKUDOTAYIM?
What's the difference between :: (double colon) and -> (arrow) in PHP?
What exactly are late static bindings in PHP?
static::staticFunctionName()
Unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting T_NS_Separator




\ Namespaces


Backslash in PHP -- what does it mean?
What does a \ (backslash) do in PHP (5.3+)?




-> Classes And Objects


What is the "->" PHP operator called and how do you say it when reading code out loud?
Where do we use the object operator "->" in PHP?
What's the difference between :: (double colon) and -> (arrow) in PHP?
What does the PHP syntax $var1->$var2 mean?
What does "->" mean/refer to in PHP?




=> Arrays


What does "=>" mean in PHP?
Use of => in PHP
What does $k => $v in foreach($ex as $k=>$v) mean?




^ Bitwise Operators


How does the bitwise operator XOR ('^') work?
What does ^ mean in PHP?




>> Bitwise Operators


What does >> mean in PHP?




<< Bitwise Operators


Strange print behaviour in PHP?




<<< Heredoc or Nowdoc


What does <<<END mean in PHP?
PHP expression <<<EOB
In PHP, what does "<<<" represent?
Using <<<CON in PHP
What's this kind of syntax in PHP?




= Assignment Operators


The 3 different equals




== Comparison Operators


How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?
PHP != and == operators
The 3 different equals
Type-juggling and (strict) greater/lesser-than comparisons in PHP




=== Comparison Operators


What does "===" mean?
How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?
The 3 different equals
Type-juggling and (strict) greater/lesser-than comparisons in PHP




!== Comparison Operators


What does !== comparison operator in PHP mean?
Is there a difference between !== and != in PHP?




!= Comparison Operators


PHP != and == operators
Is there a difference between !== and != in PHP?
comparing, !== versus !=
What is the difference between <> and !=




<> Comparison Operators


PHP operator <>
PHP's <> operator
What is the difference between <> and !=
Type-juggling and (strict) greater/lesser-than comparisons in PHP




<=> Comparison Operators(自PHP 7.0起)


Spaceship (three way comparison) operator




| Bitwise Operators


What is the difference between the | and || operators?
What Does Using A Single Pipe '|' In A Function Argument Do?




|| Logical Operators


What is the difference between the | and || operators?
PHP - and / or keywords
What exactly does || mean?
The behaviour of the or operator in PHP




~ Bitwise Operators


What does this ~ operator mean here?




+ Arithmetic OperatorsArray Operators


+ operator for array in PHP?




+=-= Assignment Operators


What is += used for?
What does `$page -= 1` in my PHP document mean?




++-- Incrementing/Decrementing Operators


Understanding Incrementing
Answer below




.= Assignment Operators


What is the difference between .= and += in PHP?
To understand a line of PHP




. String Operators


Difference between period and comma when concatenating with echo versus return?
What does a . (dot) do in PHP?




, Function Arguments


Difference between period and comma when concatenating with echo versus return?


, Variable Declarations


What do commas mean in a variable declaration?




$$ Variable Variables


What does $$ (dollar dollar or double dollar) mean in PHP?
what is "$$" in PHP
$function() and $$variable




` Execution Operator


What are the backticks `` called?




<?= Short Open Tags


What does this symbol mean in PHP <?=
What does '<?=' mean in PHP?
What does <?= mean?




[] Arrays(自PHP 5.4起的简短语法)


PHP arrays... What is/are the meaning(s) of an empty bracket?
What is the meaning of []
Php array_push() vs myArray[]
What does [] mean when reading from a PHP array?
Shorthand for arrays: literal $var = [] empty array




<? Opening and Closing tags


Are PHP short tags acceptable to use?




... Argument unpacking(自PHP 5.6起)



** Exponentiation(自PHP 5.6起)



# One-line shell-style comment


Can I use hashes for comments in PHP?




:? Nullable return types


php method argument type hinting with question mark (?type)

最佳答案

Incrementing / Decrementing Operators

++增量运算符

--减量运算符

Example    Name              Effect
---------------------------------------------------------------------
++$a       Pre-increment     Increments $a by one, then returns $a.
$a++       Post-increment    Returns $a, then increments $a by one.
--$a       Pre-decrement     Decrements $a by one, then returns $a.
$a--       Post-decrement    Returns $a, then decrements $a by one.


这些可以在变量之前或之后。

如果放在变量之前,则先对变量执行递增/递减操作,然后返回结果。如果将变量放在变量之后,则首先返回变量,然后执行增量/减量操作。

例如:

$apples = 10;
for ($i = 0; $i < 10; ++$i) {
    echo 'I have ' . $apples-- . " apples. I just ate one.\n";
}


Live example

在上述情况下,使用++$i是因为它更快。 $i++将具有相同的结果。

预增量要快一点,因为它实际上是递增变量,然后“返回”结果。后增量创建一个特殊变量,在其中复制第一个变量的值,只有在使用第一个变量之后,才将其值替换为第二个变量。

但是,必须使用$apples--,因为首先要显示当前的苹果数量,然后再从中减去一个。

您还可以在PHP中增加字母:

$i = "a";
while ($i < "c") {
    echo $i++;
}


达到z后,接着是aa,依此类推。


  请注意,字符变量可以递增但不能递减,即使如此,仅支持纯ASCII字符(a-z和A-Z)。




堆栈溢出帖子:


Understanding Incrementing

关于php - 引用-这个符号在PHP中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41882186/

相关文章:

python - 如何在argparse中将store_true和值存储在互斥组中?

rust - 有没有一种方法可以设置Clap或另一个arg lib来接受普通的 '-'或 '+',这样我就可以获得没有命名标志的参数组?

java - Perl 的 qq 运算符在 Java 中的等价物是什么?

php - Laravel 中的 PostTooLargeException

php - 如何使用函数连接到数据库以及如何使用查询?

使用 args[] 编写 Java Beanshell 脚本到程序中?

scala - 标准运算符可以被元组化或柯里化(Currying)吗?

c - "!"中的这段代码中 "Point in Polygon Test"的用途是什么?

php - 如何记录[类型]的数组?

php - Kohana Auth 模块无法登录