rank2string

(/rs/public/functions.php)

rank2string -- Turns numeric rank to string or tier number.

Description

mixed rank2string ($rank, $type = "abbr")

This function returns either a string or an integer, depending on the 2nd parameter.

The 1st parameter is the numerical rank to process. It is the id in the Ranks table that the row is retrieved from.

The 2nd parameter can be either "full", "tier", or "abbr".

If "full" is given, the full rank string is returned.

If "tier" is given, the rank tier is returned in integer format. The rank tiers are set forth in the bylaws.

If "abbr" or any other value is given, the rank abbreviation will be returned.

This function returns an empty string on failure.

Examples

rank2string () /* Returns "CDT" */

rank2string (2, "full") /* Returns "2nd Lieutenant" */

rank2string (14, "tier") /* Returns 4 */

rank2string ("foo", "bar") /* Returns empty string */

Related Functions

getRank

Dependencies

None.

Function Index