相关疑难解决方法(0)

Reference — What does this symbol mean in PHP?

What is this?

This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.

Why is this?

It used to be hard to find questions about operators and other syntax tokens.¹
The main idea is to have links to existing questions on Stack Overflow, so it's easier for us to reference them, not to copy over content from …

php arguments symbols operators

4314
推荐指数
21
解决办法
63万
查看次数

与PHP类方法中的主要下划线有什么关系?

在查看各种PHP库时,我注意到很多人选择使用单个下划线为某些类方法添加前缀,例如

public function _foo()
Run Code Online (Sandbox Code Playgroud)

...代替...

public function foo()
Run Code Online (Sandbox Code Playgroud)

我意识到这最终归结为个人偏好,但我想知道是否有人对这种习惯的来源有所了解.

我的想法是,它可能是从PHP 4继承的,在类方法可以被标记为受保护或私有之前,作为暗示"不要从类外调用此方法"的一种方式.然而,我也想到它可能起源于我不熟悉的某个地方(一种语言),或者背后可能有很好的推理,我会从中获益.

任何想法,见解和/或意见将不胜感激.

php coding-style

151
推荐指数
8
解决办法
8万
查看次数

标签 统计

php ×2

arguments ×1

coding-style ×1

operators ×1

symbols ×1