i have a long string like
$str = "this is [my] test [string] and [string] is very long [with] so many pwords]"
i know str_replace function, but when i replace
$str = str_replace( "[", "<a href=\"/story.php?urdu=",$str;
$str = str_replace( "]", "\"></a>",$str;
i got this result
<a href="/index.php?word=test"></a>
but i want this result for each word in []
<a href="/index.php?word=test">test</a>
You should use
preg_replace()for this one.Code
Working Example