我很想知道,你在PHP代码中有多少缩进空间?
function one()
{
$one;
function space()
{
$space;
}
}
function two()
{
$two;
function spaces()
{
$spaces;
}
}
function three()
{
$three;
function spaces()
{
$spaces;
}
}
function four()
{
$four;
function spaces()
{
$spaces;
}
}
Run Code Online (Sandbox Code Playgroud)
我们不会为同一缩进创建多个答案,但请将+1用于符合您偏好的答案.
Gre*_*reg 16
每个级别一个选项卡.唯一正确的方法!
Pas*_*TIN 11
我使用我正在使用的项目所使用的框架的编码标准定义的内容:
这样,项目中的所有内容都是一致的:它使在项目启动后开始处理项目的新人更容易.
当然,这也适用于其他格式化规则,例如在哪里放置{}.
经过多年的软件开发,我现在遵循每级四个空格的PSR-2标准.
每层2个空格.它在记事本中看起来很整洁.
function testfunc($x){
if($x & 1){
return $x / 2;
}
return $x;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12817 次 |
| 最近记录: |