Get values inside parentheses in PHP
$tagOne = '['; $tagTwo = ']'; $text = 'My name is [Venkataramana Ippili]'; $startTagPos = strrpos($text, $tagOne)+1; $endTagPos = strrpos($text, $tagTwo); $tagLength = $endTagPos - $startTagPos; echo $name = substr($text,$startTagPos,$tagLength);
Output : Venkataramana Ippili
0 comments:
Post a Comment