php refcount,PHP 7下变量的zval的refcount为何是2?

代码如下:

$a = "hello world";

xdebug_debug_zval('a');

然后在PHP7下运行:

a: (refcount=2, is_ref=0)='hello world'

在PHP5.5下运行:

a: (refcount=1, is_ref=0)='hello world'

PHP 7的版本信息如下:

PHP 7.1.5 (cli) (built: May 9 2017 19:49:10) ( ZTS MSVC14 (Visual C++ 2015) x64 )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

with Xdebug v2.5.4, Copyright (c) 2002-2017, by Derick Rethans

PHP 5.5的版本信息如下:

PHP 5.5.1 (cli) (built: Jul 18 2013 10:56:37)

Copyright (c) 1997-2013 The PHP Group

Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies

with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

为何PHP 7下变量的zval的refcount为何是2?

更新:今天再试了一下,在cmd命令下PHP 7.1还是显示2,然后通过浏览器访问的话,就是1,正常了,再去试了一下PHP7.0的,结果更诡异,显示的是0,如下:

λ C:\phpStudy\php\php-7.0.12-nts\php.exe -f test_zval.php

Hello_world: (refcount=0, is_ref=0)='hello world'

PHP版本如下:

λ C:\phpStudy\php\php-7.0.12-nts\php.exe -v

PHP 7.0.12 (cli) (built: Oct 13 2016 11:04:07) ( NTS )

Copyright (c) 1997-2016 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans

感觉很有可能是我本地环境的问题,尤其是laragon集成环境的问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值