How to insert a word through php between these tags?
$str ="<!-- Embed Scripts -->***СЮДА СЛОВО***<!-- End Embed -->"; ***СЮДА СЛОВО**...">
How to insert a word through php between these tags?
$str ="<!-- Embed Scripts -->***СЮДА СЛОВО***<!-- End Embed -->"; Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .
$str ="<!-- Embed Scripts --><!-- End Embed -->"; print preg_replace('/<!-- Embed Scripts -->\K/','СЛОВО',$str); With a check for the presence of a closing tag (coming immediately after the opening tag):
preg_replace('/<!-- Embed Scripts -->\K(?=<!-- End Embed -->)/','СЛОВО',$str); With the deletion of the previous content between the tags:
preg_replace('/<!-- Embed Scripts -->\K.*?(?=<!-- End Embed -->)/s','СЛОВО',$str); \K in the second variant add .*? - MikeSource: https://ru.stackoverflow.com/questions/491773/
All Articles