public function Fraction::toString in Fraction 2.x
Same name and namespace in other branches
- 8 src/Fraction.php \Drupal\fraction\Fraction::toString()
Return a string representation of the fraction.
Parameters
string $separator: The separator to place between the numerator and denominator.
Return value
string Returns a string with the numerator, separator, and denominator.
Overrides FractionInterface::toString
File
- src/
Fraction.php, line 118
Class
- Fraction
- A simple class for representing and acting upon a fraction.
Namespace
Drupal\fractionCode
public function toString(string $separator = '/') {
// Get the numerator and denominator.
$numerator = $this
->getNumerator();
$denominator = $this
->getDenominator();
// Concatenate with the separator and return.
return $numerator . $separator . $denominator;
}