Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created November 8, 2017 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/40ff6fa7db5db85cff2c4c2cfe04cad8 to your computer and use it in GitHub Desktop.
Save phpfiddle/40ff6fa7db5db85cff2c4c2cfe04cad8 to your computer and use it in GitHub Desktop.
[ Posted by Denis ] temp index for text
<?php
function textPrepare ($input)
{
//clear tags, convert chars to html units,
$input=strip_tags($input, '<br>'); //$input=strip_tags($input, '<br>');
$input=strtolower($input);
$input=htmlentities($input);
return $input;
};
$text="This is the @ world we created! 1-2+3";
$text=textPrepare ($text);
$SpecialChars="@,.-+!?1234567890";
$SpecialCharsArray=str_split($SpecialChars);
for ($i=0;$i<count ($SpecialCharsArray);$i++)
{
$SpecialCharsArrayWithFont[$i]='<span class="regularFont">'.$SpecialCharsArray[$i].'</span>';
};
$newphrase ='<span class="selectedFont">'. str_replace($SpecialCharsArray, $SpecialCharsArrayWithFont, $text).'</span>';
print_r ($newphrase);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment