Created
March 15, 2019 11:20
-
-
Save jgarciaruiz/4d9765e698c66d8b7113f51edcde02b0 to your computer and use it in GitHub Desktop.
php: bold text between pipes
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 boldText($text){ | |
$regxpattern = '#\|(.*?)\|#'; | |
$html = preg_replace($regxpattern, '<strong>$1</strong>', $text); | |
return $html; | |
} | |
$str = 'lorem ipsum |dolor| sit amet'; | |
echo boldText($str); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment