3 回答

TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個(gè)贊
echo gettype($a); // outputs "string"
echo empty($a); // outputs true, in your environment this is 1
echo is_null($a); // outputs false, "" isn't null, in your environment this is probably blank
echo isset($x); // outputs false, in your environment this is probably blank

TA貢獻(xiàn)1995條經(jīng)驗(yàn) 獲得超2個(gè)贊
你得到所有的結(jié)果:字符串、真、假和假
echo gettype($a); // outputs "string"
echo empty($a); // outputs 1 (true)
echo is_null($a); // outputs false, or "" in echo
echo isset($x); // outputs false, or "" in echo
您可以嘗試以這種方式運(yùn)行它以查看不同的結(jié)果:
echo gettype($a),'-',empty($a),'-',is_null($a),'-',isset($x),'-';
輸出:string-1---

TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超10個(gè)贊
echo gettype($a); // Outputs a "string" because the datatype used is a string
echo empty($a); // Outputs true, because the criteria that it is an empty string
echo is_null($a); // Outputs false, "" isn't null, this is probably blank
echo isset($x); //Outputs false because isset means "is set"
- 3 回答
- 0 關(guān)注
- 150 瀏覽
添加回答
舉報(bào)