3v4l.org

run code in 500+ PHP versions simultaneously
<?php $contents = "<text>Text element</text><break><list><bullet>Bullet text</bullet></list>"; $tagArray = array( "image" => "img", "title" => "h1", "text" => "p", "break" => "br", "list" => "ul", "subtitle" => "h2", "bullet" => "li", ); $from = array_map(function ($v) { return "#<(/?)$v>#"; }, array_keys($tagArray)); $to = array_map(function ($v) { return "<\$1$v>"; }, $tagArray); echo preg_replace($from, $to, $contents);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FD3EA
function name:  (null)
number of ops:  21
compiled vars:  !0 = $contents, !1 = $tagArray, !2 = $from, !3 = $to
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Ctext%3EText+element%3C%2Ftext%3E%3Cbreak%3E%3Clist%3E%3Cbullet%3EBullet+text%3C%2Fbullet%3E%3C%2Flist%3E'
    4     1        ASSIGN                                                       !1, <array>
   14     2        INIT_FCALL                                                   'array_map'
          3        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
          4        SEND_VAL                                                     ~6
          5        INIT_FCALL                                                   'array_keys'
          6        SEND_VAR                                                     !1
          7        DO_ICALL                                             $7      
          8        SEND_VAR                                                     $7
          9        DO_ICALL                                             $8      
         10        ASSIGN                                                       !2, $8
   15    11        INIT_FCALL                                                   'array_map'
         12        DECLARE_LAMBDA_FUNCTION                              ~10     [1]
         13        SEND_VAL                                                     ~10
         14        SEND_VAR                                                     !1
         15        DO_ICALL                                             $11     
         16        ASSIGN                                                       !3, $11
   16    17        FRAMELESS_ICALL_3                preg_replace        ~13     !2, !3
         18        OP_DATA                                                      !0
         19        ECHO                                                         ~13
         20      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FD3EA
function name:  {closure:/in/FD3EA:14}
number of ops:  6
compiled vars:  !0 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
          1        ROPE_INIT                                         3  ~2      '%23%3C%28%2F%3F%29'
          2        ROPE_ADD                                          1  ~2      ~2, !0
          3        ROPE_END                                          2  ~1      ~2, '%3E%23'
          4      > RETURN                                                       ~1
          5*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FD3EA
function name:  {closure:/in/FD3EA:15}
number of ops:  6
compiled vars:  !0 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        ROPE_INIT                                         3  ~2      '%3C%241'
          2        ROPE_ADD                                          1  ~2      ~2, !0
          3        ROPE_END                                          2  ~1      ~2, '%3E'
          4      > RETURN                                                       ~1
          5*     > RETURN                                                       null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.26 ms | 2239 KiB | 15 Q