Just a simple function to mark your queries smile.gif

CODE
<?php
$uzorak = 'Hosting credit';
//use post to get $uzorak variable

$tapeti = "Hosting credits are collected by posting at the forums. The hosting credits are given after your posts are filtered and depending on its size, you get proportional hosting credits. Once you get the required credits you can post an application for hosting. One of our admins will then approve your application after which you can register an account at http://www.trap17.com/process Do not try to spam and collect Hosting credits. Any methods of spamming will not be tolerated. Your Account will be banned if you are caught spamming. After you get hosting, you will have to maintain your hosting credits by staying active. Remember the amount of posts has no effect on Hosting Credits. We look for Quality rather than Quantity.";
//use file get contents to get $tapeti variable

$tagovi    = array();

work    ($uzorak, $tapeti);
function    work($uzorak, $tapeti)    {

$duzina        = strlen($uzorak);
$velicina    = strlen($tapeti);

$b = array();
$a = 0;
while    ($a <= $velicina){
$newstr    =    substr($tapeti, $a, $duzina);

if ($newstr == $uzorak){
    $tagovi[]= $a;
}
elseif ($a == $velicina && !empty($tagovi)){
    uredi_tagove($tagovi, $tapeti, $duzina);
}
elseif ($a == $velicina && empty($tagovi)) {
    echo "sorry no matches found";
    break;
}
$a++;
}
}
function uredi_tagove($tagovi, $tapeti, $duzina){
    
    $newstring ="";
    $count = count($tagovi);
    $nextchar = 0;
    for($i = 0;$i<$count;$i++)
     {
        $newstring .= substr($tapeti,$nextchar,$tagovi[$i]-$nextchar);
        $newstring .= "<strong>". substr($tapeti,$tagovi[$i],$duzina) ."</strong>";
        $nextchar = $tagovi[$i]+$duzina;
     }
     $newstring .= substr($tapeti,$nextchar);
     print $newstring;
}


?>


You can see it in action here. Just search for something (note: it might not always work as it's rather simple f-ion) smile.gif

If you want to work with me on a certain project just send me a PM wink.gif

 

 

 


Comment/Reply (w/o sign-up)