Why does foreach increase refcount by 2 instead of 1?

心已入冬 提交于 2019-12-03 08:58:43

The xdebug_debug_zval() is looking at the $array variable and not the $key variable. if you change your code to:

foreach ($array as $key => $value) {
    echo $key . " : " . $values . "<br>";
    //xdebug_debug_zval('array');

}

The correct values of the array will be returned. I don't have the xdebug function so I can't test what value you put in there.

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