php$a = 1; /* global scope */ function test(){ echo $a; /* reference to local scope variable */ }
通过将parent_scope设置为适当的整数值,可以检查活动调用堆栈中的其他作用域。值为0(默认值)将指示全局范围的变量访问。1将在当前的sandbox代码块执行时指向任何变量作用域的变量访问。
phpfunction test() { $foo = "local variable"; echo '$foo in global scope: ' .
><thalign="left"scope="col">Liveexample<thalign="left"scope="col">SVGEquivalent<thalign="left"scope

扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2026 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059
粤公网安备44030502008569号
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号
