我有一个函数,实际上它可以替代print,我想像调用print一样不使用括号来调用它。
I have a function that can effectively replace print, and I want to call it without parentheses, just like calling print.
# Replace
print $foo, $bar, "\n";
# with
myprint $foo, $bar, "\n";
在Perl中,您可以使用参数模板创建子例程,并且如果您将子例程定义为以下方式,则允许完全具有此行为。sub myprint(@) { ... }
PHP中有类似的东西吗?