Home  >  Article  >  Backend Development  >  php新手请问变量输出有关问题

php新手请问变量输出有关问题

WBOY
WBOYOriginal
2016-06-13 11:50:301119browse

php新手请教变量输出问题
问个变量输出显示的问题,老鸟见笑!
现在有变量$ssdd=array(a=>2,b=>3);我想在调试过程中输出$ssdd,而不是里面的a或者B的值
请问用什么函数输出啊。
如果直接echo $ssdd,则输出array
如果print_f($ssdd)则输出array
怎么操作能输出$ssdd这个变量的名字呢?
------解决方案--------------------
var_dump()或者print_r();
------解决方案--------------------
var_export()  
------解决方案--------------------

引用:
$只是声明变量的符号,实际的变量名为ssdd 可用get_defined_vars()获取

<br />function get_variable_name(&$var, $scope = NULL) {<br />if (NULL == $scope) {<br />    $scope = $GLOBALS;<br />}<br /><br />    $tmp = $var;<br />    $var = "tmp_exists_" . mt_rand();<br />    $name = array_search($var, $scope, TRUE);<br />    $var = $tmp;<br />    return $name;<br />}<br />echo get_variable_name($ssdd);//输出ssdd,我也没看懂<br />
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn