PHP magic methods example

旧街凉风 提交于 2019-12-03 12:15:07

Since __get() calls echo, some data is being outputted before the echo outside of the class gets called.

Stepping through the first line with echo, this is how it gets executed:

$m->a   "A" is concatenated
","     "," is concatenated
$m->b   "b," is echoed, "B" is concatenated
","     "," is concatenated
$m->c   "c," is echoed, "C" is concatenated
"m"     "," is concatenated

At this point, b,c, has already been echoed, and the string with the value of A,B,Cm is now displayed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!