Version: 1.2
Type: Function
Category: Algorithms
License: Other
Description: This function created for parsing a set of word from a sentence Mainly used for searching where many search criteria concatenate by special character like '+', ',' etc.. This module parse the whole sentence and the individual. It also count how many search criteria do user input. Created on 30th December,2002 by Himadrish Laha himadrish@yahoo.com You can also used it under GNU Lisence Rule, but must used author content in your script.
<?
// This function created for parsing a set of word from a sentence
// Mainly used for searching where many search criteria concatenate
// by special character like '+', ',' etc..
// This module parse the whole sentence and the individual. It also
// count how many search criteria do user input.
// Created on 30th DEcember,2002 by Himadrish Laha himadrish@yahoo.com
echo "Help page";
$laha="Himadrish+Laha+Subroto+paul+";
$parsec="+";
$retvalue=parseme($laha, $parsec);
?>
<?
function parseme($datavalue,$parsecharecter)
{
// $numberofserachcriteria=0;
$length_of_strng=strlen($datavalue);
$value = array();
for ($i=0;$i<=$length_of_strng;$i++)
{
$tmpval= strncmp(substr($datavalue,$i,1), $parsecharecter, 1);
if($i==$length_of_strng):
$numberofserachcriteria = $numberofserachcriteria + 1;
exit();
endif;
if ($tmpval != 0):
$tmpval=$tmpval . substr($datavalue,$i,1);
$valuelist= $valuelist . substr($tmpval,1,1) ;
else:
echo "equal-->" . $valuelist;
$numberofserachcriteria = $numberofserachcriteria + 1;
$valuelist="";
$tmpval="";
endif;
}
echo $numberofserachcriteria;
}
?>