Word of the Day

Sunday, April 6, 2008

Hebrew Numeral Converter

I have been having trouble converting numbers into Hebrew numerals. Finding nothing on the 'Net that does what I want to do, I created a Web application myself. The following is the PHP script. I will be using it to search Hebrew Bible by chapters and verses numbers.


$in = $_POST["in"];


if($in <= 999 and $in >= 900){$_900='ttq';}
elseif($in <= 899 and $in >= 800){$_900='tt';}
elseif($in <= 799 and $in >= 700){$_900='tx';}
elseif($in <= 699 and $in >= 600){$_900='tr';}
elseif($in <= 599 and $in >= 500){$_900='tq';}
elseif($in <= 499 and $in >= 400){$_900='t';}
elseif($in <= 399 and $in >= 300){$_900='x';}
elseif($in <= 299 and $in >= 200){$_900='r';}
elseif($in <= 199 and $in >= 100){$_900='q';}
else{$_900='';}



$_in099 = substr($in,-2);


if($_in099 <= 99 and $_in099 >= 90){$_090 = 'c';}
elseif($_in099 <= 89 and $_in099 >= 80){$_090 = 'p';}
elseif($_in099 <= 79 and $_in099 >= 70){$_090 = 'o';}
elseif($_in099 <= 69 and $_in099 >= 60){$_090 = 's';}
elseif($_in099 <= 59 and $_in099 >= 50){$_090 = 'n';}
elseif($_in099 <= 49 and $_in099 >= 40){$_090 = 'm';}
elseif($_in099 <= 39 and $_in099 >= 30){$_090 = 'l';}
elseif($_in099 <= 29 and $_in099 >= 20){$_090 = 'k';}
elseif($_in099 <= 19 and $_in099 >= 10){$_090 = 'i';}
else{$_090 = '';}

$_in009 = substr($in,-1);

if($_in009 == 9){$_009 = 'w';}
elseif($_in009 == 8){$_009 = 'h';}
elseif($_in009 == 7){$_009 = 'z';}
elseif($_in009 == 6){$_009 = 'v';}
elseif($_in009 == 5){$_009 = 'e';}
elseif($_in009 == 4){$_009 = 'd';}
elseif($_in009 == 3){$_009 = 'g';}
elseif($_in009 == 2){$_009 = 'b';}
elseif($_in009 == 1){$_009 = 'a';}
else{$_009 = '';}



if($_in099 == 15){$_099 = 'wv';}
elseif($_in099 == 16){$_099 = 'wz';}
else {$_099 = $_090.$_009;}

$_999 = $_900.$_099;

if(strlen($_999) > 1){
$_999g = substr($_999,0,strrpos($_999,substr($_999,-1))).'״'.substr($_999,-1);}
else{
$_999g = $_999;}

print $_999;

print '
';

print $_999g;

?>

2 comments:

Wellington Allied Health said...

where may I find this online?

Sparnai said...

http://rcpt.yousendit.com/772231870/fa363e6aefae86411f232d702a34233e