时间:2021-07-01 10:21:17 帮助过:20人阅读
$_t = get_defined_vars();$a=1;$b=2;$c=3;$t = array_diff_key(get_defined_vars(), $_t, array('_t' => ''));echo array_search(min($t), $t); //a
获取到了那个变量后打印变量名
function varName( $v ) { $trace = debug_backtrace(); $vLine = file( __FILE__ ); $fLine = $vLine[ $trace[0]['line'] - 1 ]; preg_match( "#\\$(\w+)#", $fLine, $match ); print_r( $match );}