3v4l.org

run code in 300+ PHP versions simultaneously
<?php function label_italics($string) { return preg_replace(['/[^<\/i\>]/', '/<i>/', '/<\/i>/', '/i/', '/##0/', '/#0/'], ['0', '#', '#', '0', '2', '1'], $string . ' '); } $string = 'Disney movies: <i>Aladdin</i>, <i>Beauty & the # Beast</i>. Does this <i></i> <i>work?</i>'; $stripped = strip_tags($string, 'i'); echo $string . PHP_EOL; echo $stripped . PHP_EOL; echo label_italics($string) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BTnLc
function name:  (null)
number of ops:  16
compiled vars:  !0 = $string, !1 = $stripped
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 'Disney+movies%3A+%3Ci%3EAladdin%3C%2Fi%3E%2C+%3Ci%3EBeauty+%26+the+%23+Beast%3C%2Fi%3E.+Does+this+%3Ci%3E%3C%2Fi%3E+%3Ci%3Ework%3F%3C%2Fi%3E'
    9     1        INIT_FCALL                                               'strip_tags'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'i'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   10     6        CONCAT                                           ~5      !0, '%0A'
          7        ECHO                                                     ~5
   11     8        CONCAT                                           ~6      !1, '%0A'
          9        ECHO                                                     ~6
   12    10        INIT_FCALL                                               'label_italics'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0  $7      
         13        CONCAT                                           ~8      $7, '%0A'
         14        ECHO                                                     ~8
   13    15      > RETURN                                                   1

Function label_italics:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BTnLc
function name:  label_italics
number of ops:  9
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 <array>
    5     3        SEND_VAL                                                 <array>
          4        CONCAT                                           ~1      !0, '+'
          5        SEND_VAL                                                 ~1
    4     6        DO_ICALL                                         $2      
    5     7      > RETURN                                                   $2
    6     8*     > RETURN                                                   null

End of function label_italics

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.72 ms | 1003 KiB | 16 Q