我想从函数内部获取一些值,然后在外部使用它们进行计算?可能吗?我是 PHP 新手。
假设我有代码:
function snltc($ema)
{
$uemail = $ema;
$snlc = mysql_query("SELECT * FROM usertree WHERE slot1='$uemail' || slot2='$uemail' || slot3='$uemail' || slot4='$uemail' || slot5='$uemail'");
$dsnl = mysql_fetch_array($snlc);
echo $dsnl['supemail'];
echo "</br>";
echo $dsnl['snlt'];
$sup1 = $dsnl['supemail'];
$snltu = $dsnl['snlt'] + 1;
echo "</br>";
echo $snltu;
mysql_query("UPDATE usertree SET snlt='$snltu' WHERE supemail='$sup1'");
$newsnl = mysql_fetch_array($snlc);
echo "</br>";
$snlval = $newsnl['snlt'];
echo "</br>";
return $snlval;
}
echo "</br>";
echo snltc('gami@gmail.com');
现在,我想从这段代码中使用$snlval
函数$sup1
外部和函数外部。我怎样才能做到这一点?