public static convertNumbers ( string $string ) : string | ||
$string | string | |
Résultat | string |
public static function convertNumbers($string)
{
$farsi_array = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹");
$english_array = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
return str_replace($english_array, $farsi_array, $string);
}
public function test_format_with_convert_to_persian() { $object = new jDate(); $jDate = $object->forge('2015-06-13')->format('Y-m-d'); $this->assertTrue('۱۳۹۴-۰۳-۲۳' === \Morilog\Jalali\jDateTime::convertNumbers($jDate)); }