3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <figure data-trix-attachment="{&quot;content&quot;:&quot;<span class=\&quot;trix-token\&quot; data-token-id=\&quot;landlord_name\&quot;>Jméno pronajímatele</span>&quot;}" data-trix-content-type="undefined" class="attachment attachment--content"><span class="trix-token">Jméno pronajímatele</span><figcaption class="attachment__caption"></figcaption></figure> HTML; $figureOpenTagPattern = \sprintf('<figure data-token-id="%s"[^>]*>','landlord_name'); $figureOpenTagReplacement = \sprintf('<figure data-token-id="%s">', 'landlord_name'); $figureEndTag = '<\/figure>'; $html = \preg_replace( '/' . $figureOpenTagPattern . '(.+)' . $figureEndTag . '/U', $figureOpenTagReplacement . \sprintf('<span class="trix-token %s %s" data-token-id="%s">%s</span>', 'landlord_name', 'tokenClass', 'landlord_name', 'test') . '</figure>', $html, ); echo $html;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yihe4
function name:  (null)
number of ops:  33
compiled vars:  !0 = $html, !1 = $figureOpenTagPattern, !2 = $figureOpenTagReplacement, !3 = $figureEndTag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cfigure+data-trix-attachment%3D%22%7B%26quot%3Bcontent%26quot%3B%3A%26quot%3B%3Cspan+class%3D%5C%26quot%3Btrix-token%5C%26quot%3B+data-token-id%3D%5C%26quot%3Blandlord_name%5C%26quot%3B%3EJm%C3%A9no+pronaj%C3%ADmatele%3C%2Fspan%3E%26quot%3B%7D%22+data-trix-content-type%3D%22undefined%22+class%3D%22attachment+attachment--content%22%3E%3Cspan+class%3D%22trix-token%22%3EJm%C3%A9no+pronaj%C3%ADmatele%3C%2Fspan%3E%3Cfigcaption+class%3D%22attachment__caption%22%3E%3C%2Ffigcaption%3E%3C%2Ffigure%3E'
    5     1        INIT_FCALL                                               'sprintf'
          2        SEND_VAL                                                 '%3Cfigure+data-token-id%3D%22%25s%22%5B%5E%3E%5D%2A%3E'
          3        SEND_VAL                                                 'landlord_name'
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    6     6        INIT_FCALL                                               'sprintf'
          7        SEND_VAL                                                 '%3Cfigure+data-token-id%3D%22%25s%22%3E'
          8        SEND_VAL                                                 'landlord_name'
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
    7    11        ASSIGN                                                   !3, '%3C%5C%2Ffigure%3E'
    8    12        INIT_FCALL                                               'preg_replace'
    9    13        CONCAT                                           ~10     '%2F', !1
         14        CONCAT                                           ~11     ~10, '%28.%2B%29'
         15        CONCAT                                           ~12     ~11, !3
         16        CONCAT                                           ~13     ~12, '%2FU'
         17        SEND_VAL                                                 ~13
   10    18        INIT_FCALL                                               'sprintf'
         19        SEND_VAL                                                 '%3Cspan+class%3D%22trix-token+%25s+%25s%22+data-token-id%3D%22%25s%22%3E%25s%3C%2Fspan%3E'
         20        SEND_VAL                                                 'landlord_name'
         21        SEND_VAL                                                 'tokenClass'
         22        SEND_VAL                                                 'landlord_name'
         23        SEND_VAL                                                 'test'
         24        DO_ICALL                                         $14     
         25        CONCAT                                           ~15     !2, $14
         26        CONCAT                                           ~16     ~15, '%3C%2Ffigure%3E'
         27        SEND_VAL                                                 ~16
   11    28        SEND_VAR                                                 !0
    8    29        DO_ICALL                                         $17     
         30        ASSIGN                                                   !0, $17
   14    31        ECHO                                                     !0
   15    32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.17 ms | 1007 KiB | 15 Q