Home > Backend Development > PHP Tutorial > 请问怎么找最小的变量,而不是最小的值是多少

请问怎么找最小的变量,而不是最小的值是多少

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:24:34
Original
1094 people have browsed it

请问怎么找最小的变量,而不是最小的值是多少,最小值的位置也可以。

比如:
$a=1;
$b=2;
$c=3;


回复讨论(解决方案)

$_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
Copy after login

获取到了那个变量后打印变量名

function varName( $v ) {    $trace = debug_backtrace();    $vLine = file( __FILE__ );    $fLine = $vLine[ $trace[0]['line'] - 1 ];    preg_match( "#\\$(\w+)#", $fLine, $match );    print_r( $match );}
Copy after login

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template