的确,输出函数不需要改变对象的值,应该声明为const,但是不声明为const应该也是允许的,为什么不能通过编译呢?
PHP中文网2017-04-17 13:13:25
A parameter is declared as const, which means that changes are not allowed within the function, and constants and variables can be manipulated. On the contrary, not declaring it as const means that changes are allowed and only variables can be manipulated, not constants. In other words, const formal parameters can correspond to const and non-const actual parameters, but not vice versa.