PHP示例:
function do_something(int $i) {
return $i + 2;
}
Run Code Online (Sandbox Code Playgroud)
Ruby示例:
class MyClass
# ...
end
def do_something(MyClass x)
x.prop1 = "String..."
end
Run Code Online (Sandbox Code Playgroud)
有什么类似的吗?谢谢.
到目前为止,我知道我的C. 我正在查看我下载的PHP的源文件,我看到了这种奇怪的语法:
PHPAPI int php_printf(const char *format, ...)
{
// code...
}
Run Code Online (Sandbox Code Playgroud)
PHPAPI返回类型之前做了什么int?我试过全身都在搜索,我无法理解这意味着什么.它是第二种返回类型吗?它不能是因为函数确实返回一个int.也许它扩展到头文件中声明的其他结构?