-
-
Save stalukder03/0741817c2129b3df845fde22e95806e2 to your computer and use it in GitHub Desktop.
Convert a special sign to HTML Tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function Convert_to_htmlTag($string, $tagSign='|') { | |
$firstSign = strpos($string, $tagSign); | |
$lastSign = strpos($string, $tagSign, $firstSign+1); | |
$strArray = str_split($string); | |
$replaceSigns = array($firstSign=>'<span class="se-s-color">', $lastSign=>'</span>'); | |
$replaceSigns = array_replace($strArray, $replaceSigns); | |
echo implode($replaceSigns); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment