Number
Less than 1 minute
Number
Number utility class.
class NumberThis 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
Checks if a number is odd.
public isOdd(int $number): boolParameters
| Parameter | Type | Description |
|---|---|---|
$number | int | the number to check |
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 Tue, 21 Apr 2026 04:00:24 +0000