Reputation: 962
i want insert tags in my string. which can be replaced later. for e.g.
$msg = "This message was sent [tag replaced later] at []";
is there any way to do this. Thanks.
Upvotes: 0
Views: 49
Reputation: 1760
use str_replace..
$tags = array(
'[a_tag]',
'[another_tag]'
);
$replacements = array(
'replace a tag',
'replace another tag'
);
$string = 'I want to [a_tag] and [another_tag]';
$string = str_replace($tags, $replacements,$string);
echo $string;
Upvotes: 2