3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '1<script>2</script>3<script>4</script>5'; $txt = preg_replace("/<script>.*?<\/script>/s", '', $html); var_dump($txt); //135 ←と表示したい。 //例2 $html = 'a<script>s</script>b<script>-</script>c'; $txt = preg_replace("/<script>.*?<\/script>/s", '', $html); var_dump($txt); //abc ←と表示したい。 $html = '1<script>2</script>3<script>4</script>5'; $txt = preg_replace("/<script>.*<\/script>/s", '', $html); var_dump($txt); //135 ←と表示したい。 //例2 $html = 'a<script>s</script>b<script>-</script>c'; $txt = preg_replace("/<script>.*<\/script>/s", '', $html); var_dump($txt); //abc ←と表示したい。

preferences:
22.94 ms | 402 KiB | 5 Q