コード例 #1
0
ファイル: Base.php プロジェクト: protaskin/utf8
 /**
  * @dataProvider providerUtf8GetLastChar
  */
 public function testUtf8GetLastChar($str, $rchars, $runicode)
 {
     $chars = $unicode = array();
     while (($char = utf8_get_last_char($str, $i, $cp)) !== false) {
         $chars[] = $char;
         $unicode[] = $cp;
     }
     $this->assertEquals($chars, $rchars);
     $this->assertEquals($unicode, $runicode);
 }
コード例 #2
0
ファイル: base.php プロジェクト: protaskin/utf8
/**
 * Returns a string with the characters in reverse order.
 *
 * @param  string $str The UTF-8 encoded string
 * @return string with the characters in reverse order
 */
function utf8_reverse($str)
{
    $rv = '';
    while (($char = utf8_get_last_char($str, $i)) !== false) {
        $rv .= $char;
    }
    return $rv;
}