OStack程序员社区-中国程序员成长平台

标题: php - How to get all variables defined in the current scope/symbol table? [打印本页]

作者: 菜鸟教程小白    时间: 2022-5-24 14:17
标题: php - How to get all variables defined in the current scope/symbol table?

Is there a function and/or object and/or extension in PHP that will let you view all the variables defined in the current scope? Something like:

var_export($GLOBALS)

but only showing variables in the current symbol table.



Best Answer-推荐答案


get_defined_vars

This function returns a multidimensional array containing a list of all defined variables, be them environment, server or user-defined variables, within the scope that get_defined_vars() is called.






欢迎光临 OStack程序员社区-中国程序员成长平台 (http://ostack.cn/) Powered by Discuz! X3.4