Number
Less than 1 minute
Number
Number utility class.
This class provides a number of utility functions for working with numbers.
Methods
isEven
Checks if a number is even.
public isEven(int $number): boolParameters
| Parameter | Type | Description |
|---|---|---|
$number | int | the number to check |
isOdd
public isOdd(int $number): boolParameters
| Parameter | Type | Description |
|---|---|---|
$number | int |
clamp
Clamps a number between a minimum and maximum value.
public clamp(float $number, float $min, float $max): floatParameters
| Parameter | Type | Description |
|---|---|---|
$number | float | the number to clamp |
$min | float | the minimum value |
$max | float | the maximum value |
ordinal
Returns the ordinal value of a number (e.g., 1st, 2nd, 3rd, 4th).
public ordinal(int $number): stringThis method takes an integer and returns a string representing the number with its correct ordinal suffix appended. It handles special cases like 11th, 12th, and 13th where the standard rules for 1, 2, and 3 do not apply.
Parameters
| Parameter | Type | Description |
|---|---|---|
$number | int | the number to convert |
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000