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 ←と表示したい。
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W13XB
function name:  (null)
number of ops:  41
compiled vars:  !0 = $html, !1 = $txt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '1%3Cscript%3E2%3C%2Fscript%3E3%3Cscript%3E4%3C%2Fscript%3E5'
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%3Cscript%3E.%2A%3F%3C%5C%2Fscript%3E%2Fs'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    5     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
    8    10        ASSIGN                                                   !0, 'a%3Cscript%3Es%3C%2Fscript%3Eb%3Cscript%3E-%3C%2Fscript%3Ec'
    9    11        INIT_FCALL                                               'preg_replace'
         12        SEND_VAL                                                 '%2F%3Cscript%3E.%2A%3F%3C%5C%2Fscript%3E%2Fs'
         13        SEND_VAL                                                 ''
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $7      
         16        ASSIGN                                                   !1, $7
   10    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
   12    20        ASSIGN                                                   !0, '1%3Cscript%3E2%3C%2Fscript%3E3%3Cscript%3E4%3C%2Fscript%3E5'
   13    21        INIT_FCALL                                               'preg_replace'
         22        SEND_VAL                                                 '%2F%3Cscript%3E.%2A%3C%5C%2Fscript%3E%2Fs'
         23        SEND_VAL                                                 ''
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $11     
         26        ASSIGN                                                   !1, $11
   14    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
   17    30        ASSIGN                                                   !0, 'a%3Cscript%3Es%3C%2Fscript%3Eb%3Cscript%3E-%3C%2Fscript%3Ec'
   18    31        INIT_FCALL                                               'preg_replace'
         32        SEND_VAL                                                 '%2F%3Cscript%3E.%2A%3C%5C%2Fscript%3E%2Fs'
         33        SEND_VAL                                                 ''
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                         $15     
         36        ASSIGN                                                   !1, $15
   19    37        INIT_FCALL                                               'var_dump'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.52 ms | 1405 KiB | 17 Q