我有一個PHP函數:功能是不會放棄希望的結果
<?php
function find_senior($mylevel, $sender){
global $class_database;
global $g_level1;
global $g_level2;
global $g_level3;
$sponsor=$class_database->getdata("sponsorid", "id='$sender' AND gift_level > '$mylevel'", "user");
$sponsor2=$class_database->getdata("sponsorid", "id='$sender'", "user");
if(strlen($sponsor) > '0'){
if($mylevel < $g_level1){
return array("id"=>"1", "amt"=>$g_level1, "lvl"=>$g_level1);
}
elseif($mylevel < $g_level2){
return array("id"=>"1", "amt"=>$g_level2, "lvl"=>$g_level2);
}
elseif($mylevel < $g_level3){
return array("id"=>"1", "amt"=>$g_level3, "lvl"=>$g_level3);
}
}
elseif(strlen($sponsor) <='0' && strlen($sponsor2) <='0'){
if($mylevel < $g_level1){
return array("id"=>"1", "amt"=>$g_level1, "lvl"=>$g_level1);
}
elseif($mylevel < $g_level2){
return array("id"=>"1", "amt"=>$g_level2, "lvl"=>$g_level2);
}
elseif($mylevel < $g_level3){
return array("id"=>"1", "amt"=>$g_level3, "lvl"=>$g_level3);
}
}
elseif(strlen($sponsor) <='0' && strlen($sponsor2) >'0'){
find_senior($mylevel, $sponsor2);
}
}
?>
(),它應該返回作爲數組當我們這樣做的var_dump
$array=show("100", "2");
var_dump($array);
但它僅返回:
NULL
錯誤可能在哪裏? 我很新的PHP,請儘量解決這個難題,我想了很多,但可能是我有限的知識,我ubnable解決它
您是在類中定義該函數嗎? –
適合我的工作:https://eval.in/129789 –
也適用於我.. –