/* Here's code that can extract the timestamp from a loosely formatted date string that a user inputs. It can deal with 'August 3rd, 2002' or '3 August 2002; or 2002 Aug echo ExtractTimeStamp('August 3rd, 2002'); */ /* pBreakChar = chr(13), or ',' */ function addSyn($pWords, $pBreakChar) { if ( strlen( trim( $pWords)) == 0) { return '';} $fterms = explode( $pBreakChar,$pWords); $fstr = ''; $fterm2 = ''; for ( $fj=0; $fj < count($fterms); $fj++) { if ( strtoupper(substr( $fterms[$fj],0,2)) == 'S-') { $sy = substr($fterms[$fj],2); $qs = "SELECT SWORD FROM classif.synonyms WHERE SYN2 = '$sy';"; $syns = mysql_query($qs); $numSy = mysql_num_rows($syns); for ( $m=0; $m < $numSy; $m++){ $srow = mysql_fetch_array($syns); $newval = $srow['SWORD']; } } else { $newval = $fterms[$fj];} if ($fj == 0){ /* $fterm2 = array( $newval); */ $fterm2[$fj] = $newval; $fstr = $newval; } else { /* array_push( $fterms2, $newval);*/ $fterm2[$fj] = $newval; $fstr = "$fstr".$pBreakChar.$newval; } } /* echo "addSyn: OLD: $pWords -- NEW: $fstr
\n"; */ return $fstr; } ?>