Log 2251

function convertWageToWords($wage) {
$ones = array(”, ‘אחד’, ‘שניים’, ‘שלושה’, ‘ארבעה’, ‘חמישה’, ‘שישה’, ‘שבעה’, ‘שמונה’, ‘תשעה’);
$tens = array(”, ”, ‘עשרים’, ‘שלושים’, ‘ארבעים’,
‘חמישים’,’שישים’,’שבעים’,’שמונים’,’תֵּ׳ִּסְּרִי’);

if ($wage == 0) {
return “אפס”;
} else if ($wage < 10) {
return $ones[$wage];
} else if ($wage < 20) {
$units = substr($wage, -1);
return $ones[$units] . " עשר";
} else if ($wage < 100) {
$tensDigit = floor($wage / 10);
$onesDigit = substr($wage, -1);

if ($onesDigit == 0) {
return $tens[$tensDigit];
} else {
return $tens[$tensDigit] . " ו" . convertWageToWords($onesDigit);
}
} else if ($wage < 1000) {
$hundredsDigit = floor($wage / 100);
$remainingWage = substr($wage, -2);

if ($remainingWage == 0) {
return convertWageToWords($hundredsDigit) . " מאה";
} else {
return convertWageToWords($hundredsDigit) . " מאה ו" . convertWageToWords($remainingWage);
}
} else if ($wage < 1000000) {
$thousands = floor($wage / 1000);
$remainingWage = substr($wage, -3);

if ($remainingWage == 0) {
return convertWageToWords($thousands) . " אלף";
} else {
return convertWageToWords($thousands) . " אלף ו" . convertWageToWords($remainingWage);
}
} else {
return "";
}
}

// Example usage
$wage = #סכום דמי שכר טרחה#;
return convertWageToWords($wage);

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
  • Attributes
  • Custom attributes
  • Custom fields
Click outside to hide the comparison bar
Compare