我可以在PHP中使用井号(#)进行注释吗? [英] Can I use a hash sign (#) for commenting in PHP?
问题描述
我从未见过使用哈希(#
)进行注释的PHP文件。但是今天我意识到我实际上可以做到!我假设有一个为什么每个人都使用 //
的原因,所以我在这里。
I have never, ever, seen a PHP file using hashes (#
) for commenting. But today I realized that I actually can! I'm assuming there's a reason why everybody uses //
instead though, so here I am.
除了个人喜好之外,是否还有其他理由使用 //
而不是#
来发表评论?
Is there any reason, aside from personal preference, to use //
rather than #
for comments?
推荐答案
问题的答案使用#之间是否存在任何区别和PHP中单行注释的 //是否。
The answer to the question Is there any difference between using "#" and "//" for single-line comments in PHP? is no.
没有区别。通过查看PHP源代码的解析部分,两者都#和 //由相同的代码处理,因此具有完全相同的行为。
There is no difference. By looking at the parsing part of PHP source code, both "#" and "//" are handled by the same code and therefore have the exact same behavior.
这篇关于我可以在PHP中使用井号(#)进行注释吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!