1.foo()與@foo的區(qū)別疮鲫?
@是錯(cuò)誤運(yùn)算符而叼,當(dāng)其放在PHP的某個(gè)表達(dá)式前面浮禾,該表達(dá)式可能產(chǎn)生的任何錯(cuò)誤信息都會(huì)被忽略
- 延伸考點(diǎn):
運(yùn)算符的優(yōu)先級(jí)
示例:
<?php
/**
* 下列程序中請(qǐng)寫出打印輸出的結(jié)果
* <?php
*
* $a = 0;
* $b = 0;
*
* if ($a = 3 > 0 || $b = 3 > 0)
* {
* $a++;
* $b++;
* echo $a. "\n";
* echo $b. "\n";
* }
*/
$a = 0;
$b = 0;
if ($a = 3 > 0 || $b = 3 > 0)
{
$a++;
$b++;
echo $a. "\n";
echo $b. "\n";
}