3v4l.org

run code in 300+ PHP versions simultaneously
<?php $post = (object)['content' => '<style>some random css</style>the text I really want']; $doc = new DOMDocument(); $doc->loadHTML($post->content); echo $doc->getElementsByTagName('body')->item(0)->nodeValue . "\n"; echo preg_replace('#<style>.*?</style>#', '', $post->content);

preferences:
29.78 ms | 404 KiB | 5 Q