3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "<tag>i dont know what is here</tag> don't remove this text"; $string = preg_replace('|^<([a-z]*).*|', '<$1></$1>', $string); echo $string; // <tag></tag>

preferences:
48.78 ms | 402 KiB | 5 Q