public function xpTolevel($xp)
    {
        $modifier = 0;

        for ($i = 1; $i <= 126; $i++) {
            $modifier += floor($i + 300 * pow(2, ($i / 7)));
            $level = floor($modifier / 4);

            if ($xp < $level) {
                return $i;
            }
        }

        // Return the maximum possible level
        return 126;
    }
public function xpTolevel($xp)
    {
        $modifier = 0;

        for ($i = 1; $i <= 126; $i++) {
            $modifier += floor($i + 300 * pow(2, ($i / 7)));
            $level = floor($modifier / 4);

            if ($xp < $level) {
                return $i;
            }
        }

        // Return the maximum possible level
        return 126;
    }
public function xpTolevel ( $ xp ) { $ modifier = 0 ; for ( $ i = 1 ; $ i <= 126 ; $ i ++ ) { $ modifier += floor ( $ i + 300 * pow ( 2 , ( $ i / 7 ) ) ) ; $ level = floor ( $ modifier / 4 ) ; if ( $ xp < $ level ) { return $ i ; } } // Return the maximum possible level return 126 ; }
Calculate a level with the give amount of experience

@param  int $xp
@return int
Calculate a level with the give amount of experience