php源代码中的三个大括号 [英] Three curly brackets together in php source code

查看:124
本文介绍了php源代码中的三个大括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从php.net(PHP 5.4.0 [tar.bz2])下载了完整的PHP源代码. 它们通常一起使用三个大括号,如下所示(以下代码片段是从ext/ctype/ctype.c中提取的.)

I just downloaded complete source code of PHP from php.net (PHP 5.4.0 [tar.bz2]). They are often using three curly brackets together as given below (The following code snippet extracted form ext/ctype/ctype.c.)

/* {{{ proto bool ctype_digit(mixed c)
   Checks for numeric character(s) */
 static PHP_FUNCTION(ctype_digit)
 {
  CTYPE(isdigit);
 }
/* }}} */

有人知道为什么要同时使用这三个大括号吗?

Does anyone have the idea why they are using these three curly brackets together?

推荐答案

它们是

They are vim fold markers, they make it easy to collapse and expand the text inbetween the triple curly braces in vim, in the example shown alternating between:

...

/* {{{ proto bool ctype_digit(mixed c)
   Checks for numeric character(s) */
static PHP_FUNCTION(ctype_digit)
{
    CTYPE(isdigit);
}
/* }}} */

...

还有

...

/* {{{ proto bool ctype_digit(mixed c)

...

如果您查看

If you look at the end of the file where you find them, you'll often find a block like this:

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 * vim600: sw=4 ts=4 fdm=marker
 * vim<600: sw=4 ts=4
 */

这些注释与vim相关的另一个更明显的指标.

Which is another more-obvious indicator that these comments relate to vim.

这篇关于php源代码中的三个大括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆