本文整理匯總了PHP中core_text::strrev方法的典型用法代碼示例。如果您正苦於以下問題:PHP core_text::strrev方法的具體用法?PHP core_text::strrev怎麽用?PHP core_text::strrev使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core_text
的用法示例。
在下文中一共展示了core_text::strrev方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: test_strrev
/**
* Test the strrev method.
*/
public function test_strrev()
{
$strings = array("Žluťoučký koníček" => "kečínok ýkčuoťulŽ", 'ŽLUŤOUČKÝ KONÍČEK' => "KEČÍNOK ÝKČUOŤULŽ", '言語設定' => '定設語言', '簡體中文' => '文中體簡', "Der eine stößt den Speer zum Mann" => "nnaM muz reepS ned tßöts enie reD");
foreach ($strings as $before => $after) {
// Make sure we can reverse it both ways and that it comes out the same.
$this->assertSame($after, core_text::strrev($before));
$this->assertSame($before, core_text::strrev($after));
// Reverse it twice to be doubly sure.
$this->assertSame($after, core_text::strrev(core_text::strrev($after)));
}
}
示例2: prepare_label_text
/**
* Prepare label's text for GD output.
*
* @param string $label string to be prepared.
* @return string Reversed input string, if we are in RTL mode and has no numbers.
* Otherwise, returns the string as is.
*/
private function prepare_label_text($label)
{
if (right_to_left() and !preg_match('/[0-9]/i', $label)) {
return core_text::strrev($label);
} else {
return $label;
}
}