gpt4 book ai didi

php - php源码中三个大括号放在一起

转载 作者:IT王子 更新时间:2023-10-28 23:47:48 25 4
gpt4 key购买 nike

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

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

有谁知道为什么要一起使用这三个大括号?

最佳答案

它们是 vim fold markers , 它们使得在 vim 中折叠和展开三重花括号之间的文本变得容易,在显示的示例中交替显示:

...

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

...

只是

...

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

...

如果您查看 end of the file where you find them ,你会经常发现这样的 block :

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

这是另一个更明显的指标,表明这些评论与 vim 相关。

关于php - php源码中三个大括号放在一起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9714863/

25 4 0