asOrdinal() public method

This function requires the PHP intl extension to be installed.
public asOrdinal ( mixed $value ) : string
$value mixed the value to be formatted
return string the formatted result.
Beispiel #1
0
 public function testIntlAsOrdinal()
 {
     $this->assertSame('0th', $this->formatter->asOrdinal(0));
     $this->assertSame('1st', $this->formatter->asOrdinal(1));
     $this->assertSame('2nd', $this->formatter->asOrdinal(2));
     $this->assertSame('3rd', $this->formatter->asOrdinal(3));
     $this->assertSame('5th', $this->formatter->asOrdinal(5));
     $this->formatter->locale = 'de_DE';
     $this->assertSame('0.', $this->formatter->asOrdinal(0));
     $this->assertSame('1.', $this->formatter->asOrdinal(1));
     $this->assertSame('2.', $this->formatter->asOrdinal(2));
     $this->assertSame('3.', $this->formatter->asOrdinal(3));
     $this->assertSame('5.', $this->formatter->asOrdinal(5));
     // null display
     $this->assertSame($this->formatter->nullDisplay, $this->formatter->asOrdinal(null));
 }