$a = "1" + 123;
.
.
自動類型轉換
)echo 1 + true;
echo "\n";
echo 1 + false;
echo "\n";
echo 1 + null;
echo "\n";
echo 1 + "3king";
echo "\n";
echo 1 + '21a3b4c';
echo "\n";
echo 1 + '2a3b4c';
echo "\n";
echo 1 + '2e2a3b4c';
echo "\n";
echo 1 + 'true';
echo "\n";
echo 1 + array();
echo "\n";
echo 1 + fopen('1.txt','r+');
複製代碼
自動類型轉換
)echo '1'.true;
echo "\n";
echo '1'.false.'1';
echo "\n";
echo '1'.null.'1';
echo "\n";
echo '1'.array();
複製代碼
自動類型轉換
)$dream = true;
if($dream){
echo '我在北京2環買一套小別墅';
}else{
echo '仍是老老實實的Coding吧';
}
複製代碼
其餘類型轉布爾值有什麼特色? 試舉例說明...
單選題php
如下PHP代碼片斷,運算結果正確的是()(選擇一項)spa
A echo 1+true; //輸出結果爲:1
B echo 1+false; //輸出結果爲:0
C echo 1+'2e4b5f'; //輸出結果爲:3
D echo 2+'hello'; //輸出結果爲:2
複製代碼