Math Library
IgnitedCMS ships with a variety of useful math helper utilities
Function reference
set
Parameters:
string - eg '12'
Returns:
void
Return type:
void
$this->load->library('math'); $this->math->set('12');
Function reference
print
Parameters:
none - Simply prints object
Returns:
void
Return type:
void
$this->math->set('12')->print(); Echos '12' to the view
Function reference
random
Parameters:
$min, $max - As positive integers
Returns:
void
Return type:
void
$this->math->random(1,10)->print(); Echos '7' -any random number between 1 and 10
Function reference
pow
Parameters:
int, int - e.g 2^7
Returns:
void
Return type:
void
$this->math->pow(2,2)->print(); // E.g 2 raised to the power of 2 Echos '4' to the view
Function reference
sqrt
Parameters:
int,float
Returns:
void
Return type:
void
$this->math->sqrt(49)->print(); // E.g Square root of 49 Echos '7' to the view
Function reference
dp
Parameters:
int, print number to 'n' decimal places'
Returns:
float - formated to n decimal places
Return type:
float
$this->math->set('25.44555')->dp(2)->print(); Echos '25.45' to the view