Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6609273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:41:54+00:00 2026-05-25T19:41:54+00:00

What is wrong with this function? When I use 31 for exp , this

  • 0

What is wrong with this function? When I use 31 for exp, this function becomes an infinite loop! How can I fix that? Please help and optimize this function for me if you can, thanks.

public function exp_calc($exp)
    {
        $level2 = 30; // Required EXP for 2nd level
        $current_lvl = 0; // Current level
        $level = 0; // Required EXP for next level

        while((int)$level <= $exp)
        {
            $level += $level2;
            $level2 *= 0.25;
            $current_lvl++;
        }

        if($current_lvl >= 80)
            $current_lvl = 80;

        return array ($current_lvl, (int)$level);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:41:55+00:00Added an answer on May 25, 2026 at 7:41 pm

    $level2 *= 0.25;

     1   2     3
    30 7.5 1.125
    

    I assume you mean *= 1.25 there, to increase the amount of experience needed for the next level exponentially :).

    The current function limits somewhere below 40 I think (get some calculus to calculate the limit ;)).

    Edit; to clearify (since I though it wasn’t yet):

    level one requires 30 exp total now;
    level two requires 7.5 additional exp; total of 37.5
    level three requires 1.125 exp; total of 38.625
    etc.

    When using *= 1.25; the amount of exp needed to reach the next level actually increases:
    30 -> 37.5 -> 46.875 -> 58.594 -> etc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone see anything wrong with this login script: public function login($username, $pass, $remember)
whats wrong with this? anybody help me please.. if(stripos($nerde, $hf) !== false) && (stripos($nerde,
What's wrong with this function: function() { $.get('/controller/action', function(data) { $('#temporaryPhotos').text(data); } ); return
What is wrong with this function... The function intends to remove the specified leading
Not sure if this is intended behavior or a bug or a wrong function
I have this big function (1300+ lines of code) that takes data from the
I'm trying to figure out how to use this function. I found it on
Please forgive me if any of this is wrong -I'm completely new to Java.
request.fetchLimit = 100; request.fetchBatchSize = 100; is it true use that function to make
Chances are that I am doing this wrong, but here goes. I'm using lift-json

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.