为什么它不起作用? [英] why it does not work?
本文介绍了为什么它不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
echo (true?''true'':''t''); //it''s wrong......why???
推荐答案
这当然应该评估为''true''
.
它应该(并且确实)打印字符串"true".
如果您希望这样做,则需要查看 ^ ].
It should (and does) print the string "true".
If you expect it to do otherwise, then you need to look at the PHP ternary operator[^] in more detail.
您的注释中的错误消息表明echo
之前的行缺少分号(;
).
;
在PHP中不是可选的.
The error message in your comment suggests that the line before theecho
is missing a semi-colon (;
) at the end of it.
The;
is not optional in PHP.
这篇关于为什么它不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文