Skip to content

Instantly share code, notes, and snippets.

@stalukder03
Forked from mdjwel/creatSpanTag.php
Created December 28, 2017 07:46
Show Gist options
  • Save stalukder03/0741817c2129b3df845fde22e95806e2 to your computer and use it in GitHub Desktop.
Save stalukder03/0741817c2129b3df845fde22e95806e2 to your computer and use it in GitHub Desktop.
Convert a special sign to HTML Tag
<?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