我应该在这里做什么?



=& 参考

参考任务操作员在PHP, =& 什么意思是“=&”和“&="操作员在PHP? 什么意思是“&=”和“=&”操作员在PHP?

















PHP 中的奇怪打印行为?



= 任命运营商

三种不同的平等


如何区分PHP平等(==双等)和身份(===三等)比较操作员?PHP!=和 ==操作员3个不同的平等类型和(严格)较大的/较小的比较在PHP


=== 比较运营商






比特币运营商


上一篇: 逻辑运营商












[ ] Arrays (自 PHP 5.4 以来简短的合成)


PHP 短标签是否可用?


二角形字符范围




# One-line shell 风格评论


NullSafe Operator 通话(自 PHP 8.0 以来)

PHP 中有“零安全操作员”吗?



当前回答


逻辑操作员:


比较运营商:


算法操作员:

-$a : 相反的 $a. $a + $b : 合金的 $a 和 $b. $a - $b : 差异的 $a 和 $b. $a * $b : 产品的 $a 和 $b. $a / $b : 比例的 $a 和 $b. $a % $b : 剩余的 $a 分为 $b. $a ** $b : 增加 $a 到 $b 的功率的结果(引入 PHP 5.6)




紧密运营商:


Array 运营商:


任命运营商:


笔记

其他回答

_ Alias for gettext( )

作为 _() 的字符“_”是 gettext() 函数的标志。

比特币运营商

什么是比特? 比特是 1 或 0 的代表性 基本上是 OFF(0) 和 ON(1)

什么是比特?一个比特是由8位组成的,一个比特的最高值是255,这意味着每个比特是设置的。

-------------------------------------------
|      1 Byte ( 8 bits )                  |
-------------------------------------------
|Place Value | 128| 64| 32| 16| 8| 4| 2| 1|     
-------------------------------------------

此分類上一篇: 1 Byte

1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 = 255 (1 位元)

一些好理解的例子

“和”运营商: &

$a =  9;
$b = 10;
echo $a & $b;

这将产生第8号为什么? 好吧,让我们看看使用我们的表例子。

-------------------------------------------
|      1 Byte ( 8 bits )                  |
-------------------------------------------
|Place Value | 128| 64| 32| 16| 8| 4| 2| 1|     
-------------------------------------------
|      $a    |   0|  0|  0|  0| 1| 0| 0| 1|    
-------------------------------------------
|      $b    |   0|  0|  0|  0| 1| 0| 1| 0|
------------------------------------------- 
|      &     |   0|  0|  0|  0| 1| 0| 0| 0|
------------------------------------------- 

所以你可以从桌子上看到他们共享的唯一片段是8位。

第二个例子

$a =  36;
$b = 103;
echo $a & $b; // This would output the number 36.
$a = 00100100
$b = 01100111

兩個共享比特是32和4,當添加一起返回36。

“黄金”运营商: <unk>

$a =  9;
$b = 10;
echo $a | $b;

第11章 为什么?

-------------------------------------------
|      1 Byte ( 8 bits )                  |
-------------------------------------------
|Place Value | 128| 64| 32| 16| 8| 4| 2| 1|     
-------------------------------------------
|      $a    |   0|  0|  0|  0| 1| 0| 0| 1|    
-------------------------------------------
|      $b    |   0|  0|  0|  0| 1| 0| 1| 0|
------------------------------------------- 
|      |     |   0|  0|  0|  0| 1| 0| 1| 1|
-------------------------------------------

您将注意到,我们有 3 个字符串设置,在 8、2 和 1 个列中。

NullSafe 操作员 “?>” 从 php8

在PHP8已经接受了这个新的运营商,你可以在这里找到文档。>它是NullSafe运营商,它返回零,如果你试图引用功能或从零获得值。

例子:

<?php
$obj = null;
$obj = $obj?->attr; //return null
$obj = ?->funct(); // return null
$obj = $objDrive->attr; // Error: Trying to get property 'attr' of non-object
?>

== 用于检查平等而不考虑变量数据类型

=== 用于检查变量值和数据类型的平等。

例子

A = 5 美元

如果($a = = 5 ) - 将评估为真实的如果($a = 5 ) - 将评估为真实的,因为同时比较这两个值 PHP 内部将该行值转换为整体,然后比较两个值如果($a = 5 ) - 将评估为真实的如果($a = 5 ) - 将评估为虚假的,因为值是 5,但这个值5 不是整体。

Syntax Name Description
x == y Equality true if x and y have the same key/value pairs
x != y Inequality true if x is not equal to y
x === y Identity true if x and y have the same key/value pairs
in the same order and of the same types
x !== y Non-identity true if x is not identical to y
x <=> y Spaceship 0 if x is equal to y, greater than 0 if x > y, less than 0 if x < y
++x Pre-increment Increments x by one, then returns x
x++ Post-increment Returns x, then increments x by one
--x Pre-decrement Decrements x by one, then returns x
x-- Post-decrement Returns x, then decrements x by one
x and y And true if both x and y are true. If x=6, y=3 then
(x < 10 and y > 1) returns true
x && y And true if both x and y are true. If x=6, y=3 then
(x < 10 && y > 1) returns true
x or y Or true if any of x or y are true. If x=6, y=3 then
(x < 10 or y > 10) returns true
x || y Or true if any of x or y are true. If x=6, y=3 then
(x < 3 || y > 1) returns true
a . b Concatenation Concatenate two strings: "Hi" . "Ha"