Ok I put together in one page the string and keyword to search for with a skip of equidistant letter sequences:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bible Code Example</title>
</head>
<body>
<input id="skiprow" type="text" value="50" />
<input id="word" type="text" value="תורה" />
<a href="JavaScript: ext='?skiprow='+document.getElementById('skiprow').value+'&word='+document.getElementById('word').value; window.location=ext;">search this</a><br /><br />
<?php
$skiprow=isset($_GET['skiprow']) ? $_GET['skiprow'] : '';
$word=isset($_GET['word']) ? $_GET['word'] : '';
$text_of_this_chapter="בראשיתבראאלהימאתהשמימואתהארצוהארצהיתהתהוובהווחשכעלפניתהומורוחאלהיממרחפתעלפניהמימויאמראלהימיהיאורויהיאורויראאלהימאתהאורכיטובויבדלאלהימבינהאורובינהחשכויקראאלהימלאוריומולחשכקראלילהויהיערבויהיבקריומאחדויאמראלהימיהירקיעבתוכהמימויהימבדילבינמימלמימויעשאלהימאתהרקיעויבדלבינהמימאשרמתחתלרקיעובינהמימאשרמעללרקיעויהיכנויקראאלהימלרקיעשמימויהיערבויהיבקריומשניויאמראלהימיקווהמיממתחתהשמימאלמקומאחדותראההיבשהויהיכנויקראאלהימליבשהארצולמקוההמימקראימימויראאלהימכיטובויאמראלהימתדשאהארצדשאעשבמזריעזרעעצפריעשהפרילמינואשרזרעובועלהארצויהיכנותוצאהארצדשאעשבמזריעזרעלמינהוועצעשהפריאשרזרעובולמינהוויראאלהימכיטובויהיערבויהיבקריומשלישיויאמראלהימיהימארתברקיעהשמימלהבדילבינהיומובינהלילהוהיולאתתולמועדימולימימושנימוהיולמאורתברקיעהשמימלהאירעלהארצויהיכנויעשאלהימאתשניהמארתהגדלימאתהמאורהגדללממשלתהיומואתהמאורהקטנלממשלתהלילהואתהכוכבימויתנאתמאלהימברקיעהשמימלהאירעלהארצולמשלביומובלילהולהבדילבינהאורובינהחשכויראאלהימכיטובויהיערבויהיבקריומרביעיויאמראלהימישרצוהמימשרצנפשחיהועופיעופפעלהארצעלפנירקיעהשמימויבראאלהימאתהתנינמהגדלימואתכלנפשהחיההרמשתאשרשרצוהמימלמינהמואתכלעופכנפלמינהוויראאלהימכיטובויברכאתמאלהימלאמרפרוורבוומלאואתהמימבימימוהעופירבבארצויהיערבויהיבקריומחמישיויאמראלהימתוצאהארצנפשחיהלמינהבהמהורמשוחיתוארצלמינהויהיכנויעשאלהימאתחיתהארצלמינהואתהבהמהלמינהואתכלרמשהאדמהלמינהוויראאלהימכיטובויאמראלהימנעשהאדמבצלמנוכדמותנווירדובדגתהימובעופהשמימובבהמהובכלהארצובכלהרמשהרמשעלהארצויבראאלהימאתהאדמבצלמובצלמאלהימבראאתוזכרונקבהבראאתמויברכאתמאלהימויאמרלהמאלהימפרוורבוומלאואתהארצוכבשהורדובדגתהימובעופהשמימובכלחיההרמשתעלהארצויאמראלהימהנהנתתילכמאתכלעשבזרעזרעאשרעלפניכלהארצואתכלהעצאשרבופריעצזרעזרעלכמיהיהלאכלהולכלחיתהארצולכלעופהשמימולכלרומשעלהארצאשרבונפשחיהאתכלירקעשבלאכלהויהיכנויראאלהימאתכלאשרעשהוהנהטובמאדויהיערבויהיבקריומהששי";
$alephbet= Array("א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י", "כ", "ל", "מ", "נ", "ס", "ע", "פ", "צ", "ק", "ר", "ש", "ת", "ך", "ם", "ן", "ף", "ץ");
$alphabet= Array("a", "b", "g", "d", "h", "u", "z", "x", "w", "i", "k", "l", "m", "n", "c", "o", "p", "e", "q", "r", "f", "t", "k", "m", "n", "p", "e");
$into_alephbet= Array("א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י", "כ", "ל", "מ", "נ", "ס", "ע", "פ", "צ", "ק", "ר", "ש", "ת");
$vm=array("ְ", "ּ", "ֵ", "ִ", "ׁ", "֖", "ָ", "ֱ", "ֹ", "ֵ", "ַ", "ׁ", "ֽ", "ֶ", "֣", "֑", "֥", "֥", "־", "֗", "֙", "֙", "֔", "֔", "׃", "־", "֗", "֙", "֙", "֔", "֔", "֧", "֛", "֨", "֤", " ׀ ", "ׂ", "֮", "֒", "ֲ", "ֲ", "֚", "֚", " ֜", "֠", "֩", "֜", "֞", "֕", "֡", "ֻ", "ֻ", "ֳ", "פ ׃");
$chars=Array();
$keyword_letters=Array();
$chars=Array();
$strKeyword=$word;
for($i=0; $i<count($alephbet); $i++){
$strKeyword=str_replace($alephbet[$i], $alphabet[$i], $strKeyword);
}
$strKeyword=str_replace(" ", "", $strKeyword);
$kw_into_letters=str_split($strKeyword);
for($eng=0; $eng<count($kw_into_letters); $eng++){
for($heb=0; $heb<count($into_alephbet); $heb++){
if($alphabet[$heb]==$kw_into_letters[$eng]){
$chars[]=$into_alephbet[$heb];
}
}
}
echo "Looking for:".implode($chars);
for($i=0; $i<count($vm); $i++){
$text_of_this_chapter=str_replace($vm[$i], "", $text_of_this_chapter);
}
$text_of_this_chapter=str_replace(" ", "", $text_of_this_chapter);
for($i=0; $i<count($alephbet); $i++){
$text_of_this_chapter=str_replace($alephbet[$i], $alphabet[$i], $text_of_this_chapter);
}
$str_into_heb_letters=str_split($text_of_this_chapter);
for($i=0; $i<count($alphabet); $i++){
$str_into_heb_letters=str_replace($alphabet[$i], $alephbet[$i], $str_into_heb_letters);
}
$string=$text_of_this_chapter;
$COLORS=array('red', 'blue');
$string_split=$str_into_heb_letters;//str_split($string);
$strlen=strlen($string);
if($skiprow=="all"){
$skiprow=$strlen;
}
$instances=array();
$continue=true;
$pos=0;
?>
<table style="float: left; direction: rtl; text-align: left; padding: 5px;">
<tr>
<?php //<th style="border: 1px solid black;"></th>
for($i=0; $i<$skiprow; $i++){
$num=$i+1;
echo "<th style=\\"border: 1px solid black; font-size: 14px;\\">".$num."</th>\
";
}
?>
</tr>
<tr>
<?php
while($continue){
$instance=array();
foreach($chars as $char){
if(($newPos=strpos($string, $char, $pos)) !== false){
array_push($instance, $newPos);
$string=substr_replace($string, '#', $newPos, 1);
$pos=$newPos;
}else{
$continue=false;
break;
}
}
if(count($instance)==count($chars)){
array_push($instances, $instance);
$pos=0;
}
}
foreach ($instances as $i=>$instance){
//echo 'The character at position ', $i, ' is "', $instance, '"<br />';
$color=$COLORS[$i];
foreach($instance as $char){
$string_split[$char]="<td style=\\"border: 1px solid black; font-weight: bold; color: ".$color.";\\">".$string_split[$char]."</td>\
";
}
}
foreach($string_split as $i=>$part){
//echo 'The character at position ', $i, ' is "', $part, '"<br />';
if (strlen($part) <3){
$string_split[$i] = "<td style=\\"border: 1px solid black;\\">".$string_split[$i]."</td>";
}
if ($i % $skiprow==0 && $i>0){
$string_split[$i] = '</tr><tr>'.$string_split[$i];
}
}
echo implode("", $string_split);
?>
</tr>
</table>
</body>
</html>