3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<h1>Oude tekst hier</h1>'; $search = "/[^<h1>](.*)[^<\/h1>]/"; $replace = "Here my new text"; $content = preg_replace($search,$replace,$string); echo $content;
Output for 7.4.0 - 7.4.29, 8.0.1 - 8.0.19, 8.1.0 - 8.1.6
<h1>Here my new text</h1>

preferences:
44.48 ms | 409 KiB | 5 Q