Notice: Undefined variable:

linpc

Гуру форума
Регистрация
6 Апр 2012
Сообщения
178
Реакции
55
Notice: Undefined variable: arr in /var/www/adminlinpcrus/data/www/gamele.ru/includes/functions_game.php on line 531
PHP:
function exp_level($level) {//-- Определение уровня
    switch ($level) {
        case 0: $arr = array("exp" => 100, "ma" => 8, "ex" => 1, "frs" => 15, "nv" => 50, "nav" => 1, "mum" => 2, "bum" => 10);
            break;
        case 1: $arr = array("exp" => 300, "ma" => 12, "ex" => 1, "frs" => 3, "nv" => 100, "nav" => 1, "mum" => 3, "bum" => 4);
            break;
        case 2: $arr = array("exp" => 800, "ma" => 16, "ex" => 1, "frs" => 3, "nv" => 150, "nav" => 0, "mum" => 4, "bum" => 5);
            break;
        case 3: $arr = array("exp" => 1800, "ma" => 20, "ex" => 1, "frs" => 3, "nv" => 200, "nav" => 0, "mum" => 4, "bum" => 5);
            break;
        case 4: $arr = array("exp" => 3500, "ma" => 24, "ex" => 1, "frs" => 5, "nv" => 300, "nav" => 1, "mum" => 5, "bum" => 4);
            break;
        case 5: $arr = array("exp" => 5500, "ma" => 40, "ex" => 1, "frs" => 5, "nv" => 350, "nav" => 1, "mum" => 5, "bum" => 5);
            break;
        case 6: $arr = array("exp" => 10000, "ma" => 52, "ex" => 1, "frs" => 5, "nv" => 250, "nav" => 0, "mum" => 6, "bum" => 6);
            break;
        case 7: $arr = array("exp" => 18000, "ma" => 56, "ex" => 1, "frs" => 10, "nv" => 300, "nav" => 0, "mum" => 7, "bum" => 6);
            break;
        case 8: $arr = array("exp" => 30000, "ma" => 64, "ex" => 1, "frs" => 5, "nv" => 400, "nav" => 1, "mum" => 8, "bum" => 7);
            break;
        case 9: $arr = array("exp" => 50000, "ma" => 76, "ex" => 1, "frs" => 7, "nv" => 500, "nav" => 0, "mum" => 9, "bum" => 8);
            break;
        case 10: $arr = array("exp" => 200000, "ma" => 80, "ex" => 1, "frs" => 15, "nv" => 400, "nav" => 1, "mum" => 12, "bum" => 10);
            break;
        case 11: $arr = array("exp" => 500000, "ma" => 104, "ex" => 1, "frs" => 7, "nv" => 500, "nav" => 0, "mum" => 15, "bum" => 5);
            break;
        case 12: $arr = array("exp" => 900000, "ma" => 120, "ex" => 1, "frs" => 12, "nv" => 600, "nav" => 1, "mum" => 15, "bum" => 10);
            break;
        case 13: $arr = array("exp" => 1600000, "ma" => 136, "ex" => 1, "frs" => 10, "nv" => 600, "nav" => 1, "mum" => 20, "bum" => 15);
            break;
        case 14: $arr = array("exp" => 3000000, "ma" => 150, "ex" => 1, "frs" => 12, "nv" => 800, "nav" => 0, "mum" => 12, "bum" => 15);
            break;
        case 15: $arr = array("exp" => 10000000, "ma" => 170, "ex" => 1, "frs" => 15, "nv" => 1000, "nav" => 1, "mum" => 15, "bum" => 15);
            break;
        case 16: $arr = array("exp" => 25000000, "ma" => 180, "ex" => 1, "frs" => 15, "nv" => 1500, "nav" => 1, "mum" => 25, "bum" => 20);
            break;
        case 17: $arr = array("exp" => 50000000, "ma" => 190, "ex" => 1, "frs" => 15, "nv" => 2000, "nav" => 0, "mum" => 25, "bum" => 20);
            break;
        case 18: $arr = array("exp" => 80000000, "ma" => 200, "ex" => 1, "frs" => 15, "nv" => 2500, "nav" => 1, "mum" => 25, "bum" => 20);
            break;
        case 19: $arr = array("exp" => 160000000, "ma" => 220, "ex" => 1, "frs" => 15, "nv" => 3000, "nav" => 1, "mum" => 15, "bum" => 20);
            break;
        case 20: $arr = array("exp" => 500000000, "ma" => 240, "ex" => 1, "frs" => 10, "nv" => 3500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 21: $arr = array("exp" => 1200000000, "ma" => 240, "ex" => 1, "frs" => 15, "nv" => 4000, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 22: $arr = array("exp" => 1000000000, "ma" => 240, "ex" => 1, "frs" => 20, "nv" => 4500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 23: $arr = array("exp" => 2000000000, "ma" => 240, "ex" => 1, "frs" => 25, "nv" => 5500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 24: $arr = array("exp" => 4000000000, "ma" => 240, "ex" => 1, "frs" => 20, "nv" => 6500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 25: $arr = array("exp" => 5000000000, "ma" => 240, "ex" => 1, "frs" => 30, "nv" => 7500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 26: $arr = array("exp" => 6000000000, "ma" => 240, "ex" => 1, "frs" => 35, "nv" => 8500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 27: $arr = array("exp" => 7000000000, "ma" => 240, "ex" => 1, "frs" => 40, "nv" => 10500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 28: $arr = array("exp" => 8000000000, "ma" => 240, "ex" => 1, "frs" => 45, "nv" => 12500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 29: $arr = array("exp" => 9000000000, "ma" => 240, "ex" => 1, "frs" => 50, "nv" => 15500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
        case 30: $arr = array("exp" => 1200000000, "ma" => 240, "ex" => 1, "frs" => 55, "nv" => 17500, "nav" => 0, "mum" => 25, "bum" => 10);
            break;
    }
    return $arr;
}

return $arr;//-- Код ошибки, как я предполагаю нужно поставить проверку существует ли она?
return isset($arr);

Или как всегда я запуток?
 
default:
$arr = array();
поставь в свитче после последнего break

P.S.: мой вам совет, вместо "bum", "nav" заведите правило использовать константы чтоб потом было так

$arr = array(CONTS_EXP => ...., CONST_MA => ...) и так далее, потом легше рефакторить и не ошибиться в значении ключа
 
Последнее редактирование:
Назад
Сверху