public function Fraction::toString in Fraction 7
Return a string representation of the fraction.
Parameters
$separator: The separator to place between the numerator and denominator.
Return value
string Returns a string with the numerator, separator, and denominator.
File
- ./
fraction.class.inc, line 109 - Fraction class
Class
- Fraction
- @file Fraction class
Code
public function toString($separator = '/') {
// Get the numerator and denominator.
$numerator = $this
->getNumerator();
$denominator = $this
->getDenominator();
// Concatenate with the separator and return.
return $numerator . $separator . $denominator;
}