You are here

function _calendar_jalali_convert_number in Calendar Systems 6.2

Helper function to convert a Latin number to its Persian representaion.

Parameters

$string: The haystack string to be googled!

Return value

Number-Persianized string!

1 call to _calendar_jalali_convert_number()
calendar_jalali_formatter in calendars/calendar_jalali/calendar_jalali.module
Jalali calendar date formatter callback.

File

calendars/calendar_jalali/calendar_jalali.module, line 435
Implements necessary hooks & helpers to support Jalali Calendar.

Code

function _calendar_jalali_convert_number($string) {
  $output = '';
  $max = strlen(trim($string));
  for ($i = 0; $i < $max; ++$i) {
    $output .= ctype_digit($string[$i]) ? pack('C*', 0xdb, 0xb0 + $string[$i]) : $string[$i];
  }
  return $output;
}