我对在 php 语法中添加一些特性很感兴趣,而且对我来说很明显它与为该语言编写模块不同。我想知道这需要在 C 语言中编辑资源,该资源可在 php.net 网站上获得,并且自然是 C 编程知识。只是我想做以下事情:
xforeach ($array as $item with $counter) {
echo "This is $counter time this loop is happening";
}
而不是写:
$counter = 0;
foreach ($array as $item) {
echo "This is $counter time this loop is happening";
$counter ++;
}
或者在另一个方面,为每个类或函数添加属性,就像在 C# 中一样
class MyClass {
[Description("This is my php 6 version")]
public function Test() {
}
}
实现这种方法的第一步是什么?