How would I insert text between two comments like the ones below with PHP. Thanks in advance.
Maybe just insert after first tag ?
$afterinsert = str_replace( "INSERT 1 -->" , "INSERT 1 -->\n".$toinsert , $beforeinsertion );
If you want to insert only when there are both tags, use preg_replace.