- var_dump: documentation ( source)
- preg_replace: documentation ( source)
<?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 ←と表示したい。