一个赋值表达式的意义在于值的指派。也就是说,“$a=3”的值是3。这就允许您做这样的事情:
$a = ($b = 4) + 5;
// $a is equal to 9 now, and $b has been set to 4.
作为赋值操作符的一个补充,还有一个针对二进制数和字符传进行操作的组合操作符,该操作符允许您在赋值方采用被赋值表达式的值。例如:
$a = 3;
$a += 5; // sets $a to 8, as if we had said: $a = $a + 5;
$b = "Hello ";
$b .= "There!"; // sets $b to "Hello There!", just like $b = $b . "There!";
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/