Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/ngfw/Recipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -1405,4 +1405,46 @@ public static function bytesToHumanReadableSize($size, $precision = 2)

return round($size, $precision).' '.['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'][$i];
}

/**
*Converts numbers to Hebrew numerals
*
* @param int any number between 1 and 500
*
* @return hebrew numeral
*/
public static function numToHebrew($num) {
$hebrew_numerals = explode(" ", "א ב ג ד ה ו ז ח ט ");
$tens = array("", "י", "כ", "ל", "מ", "נ", "ס", "ע", "פ", "צ");
$hundreds = array("", "ק", "ר", "ש", "ת");

$hebrew = "";

// Handle special cases for 15 and 16
if ($num == 15) {
return "ט״ו";
}
if ($num == 16) {
return "ט״ז";
}

// Calculate hundreds
while ($num >= 100) {
$hebrew .= $hundreds[intval($num / 100)];
$num %= 100;
}

// Calculate tens
if ($num >= 10) {
$hebrew .= $tens[intval($num / 10)];
$num %= 10;
}

// Calculate ones
if ($num > 0) {
$hebrew .= $hebrew_numerals[$num - 1];
}

return $hebrew;
}
}