4
<?php
    # some comment
 ?>

and

<?php 
   // some comment
?>

are used for single-line code commenting in PHP, and that former comes from shell scripting and // comes from C++.

However I am curious to know if there are any differences between using // and # for single line commenting and anyone has come across cases specific cases where one or other should not be used.

Only difference I could think of is there is one character in '#' and two in '//' so perhaps will there in larger scripts some small size and/or performance gains ??

4

1 回答 1

3

//对我来说,通过双击键盘上的键将我的右小指向下移动一个键并按两次会更容易打字。

如果我想这样做,#我需要用双手并且动作“更大”;)。对于echo和也是一样print

但是在打印和回显“场景”中,您可以听到一个论点,即一个函数要慢一些,但是我现在不确定哪个函数;)但我猜在优化代码时确实不会破坏交易。

根据这个主题echo有点快: 我应该在php脚本中使用echo还是print?

于 2013-06-12T15:47:48.647 回答