Jump to content
MakeWebGames

Recommended Posts

Posted

Ok so i am highlighting the text in explore using...

 

function highlightWords($string, $words)
{
   foreach ( $words as $word )
   {
       $string = str_ireplace($word, '<span class="highlight_word">'.$word.'</span>', $string);
   }
   /*** return the highlighted string ***/
   return $string;
}
$string = 'http://xvon.info/game/register.php?REF=$userid';
$words = array('http://xvon.info/game/register.php?REF=$userid');
$string =  highlightWords($string, $words);

 

Problem with using this is that it dosn't display the actuall userid it just display the code $userid

How am i able to highlight this particular text?

Thanks.

Posted
function highlightWords($string, $words)
{
   foreach ( $words as $word )
   {
       $string = str_ireplace($word, '<span class="highlight_word">'.$word.'</span>', $string);
   }
   /*** return the highlighted string ***/
   return $string;
}
$string = 'http://xvon.info/game/register.php?REF='.$userid.'';
$words = array('http://xvon.info/game/register.php?REF='.$userid.'');
$string =  highlightWords($string, $words);
Posted

As posted above by Equinox.

'.$var.'/".$var."

The default for MCC is to wrap the variable with { & }. I have always used the other technique but im un-aware of any differences.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...