Can I use a hash sign (#) for commenting in PHP?

前端 未结 11 649
你的背包
你的背包 2021-01-31 13:07

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

11条回答
  •  青春惊慌失措
    2021-01-31 13:37

    Yes, however there are cross platform differences.

    I use # all the time for commenting in PHP, but I have noticed an adoption difference.

    On windows keyboard the # key is easy to use. On mac keyboard # key mostly isn't present.

    So for mac users, [Alt] + [3] or [⌥] + [3] is more difficult to type than //, so // has become a cross platform way of displaying code with comments.

    This is my observation.

提交回复
热议问题