How would I insert text between two comments like the ones below with PHP. Thanks in advance.
<!-- BEGIN INSERT 1 -->
<!-- END INSERT 1 -->
How would I insert text between two comments like the ones below with PHP. Thanks in advance.
<!-- BEGIN INSERT 1 -->
<!-- END INSERT 1 -->
a little more context might be helpful. it could be as easy as:
what are you trying to do?
Maybe just insert after first tag ?
If you want to insert only when there are both tags, use preg_replace.
This will do the job. It's using
substr_replace()
. You can read more about it here.