1
votes

is it possible to str_replace or some form of other method which allows you to replace text within some content with a html button?

I have this tag @create@ within a paragraph that I would like to replace with <a href="link here">Create Account</a>

is this possible?

1
Why do you think that's any different from any other use of str_replace()? - Barmar
@Barmar because I was using html tags to replace it with but yeah realised the actual source of the textarea value is just a string anyway so yeah my bad - Lowtiercoder

1 Answers

1
votes

Sure, use str_replace.

Here's a quick sample:

$variable = 'Hello, create your account: @create@';
echo str_replace("@create@", "<a href=\"link here\">Create Account</a>", $variable);

The example above will output:

Hello, create your account: <a href="link here">Create Account</a>