3v4l.org

run code in 300+ PHP versions simultaneously
<?php $your_variable = '[section title="This is the title"]'; $your_variable = str_replace('type="full" type="wrapper"]','type="full"]',preg_replace ( '/\[section([^\]]+)(?!type)\]/i' , '[section$1 type="wrapper"]' , $your_variable )); echo "First try: ".$your_variable."\n"; $your_variable = '[section title="This is the title" type="full"]'; $your_variable = str_replace('type="full" type="wrapper"]','type="full"]',preg_replace ( '/\[section([^\]]+)(?!type)\]/i' , '[section$1 type="wrapper"]' , $your_variable )); echo "First try: ".$your_variable."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FQ6TZ
function name:  (null)
number of ops:  31
compiled vars:  !0 = $your_variable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5Bsection+title%3D%22This+is+the+title%22%5D'
    5     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 'type%3D%22full%22+type%3D%22wrapper%22%5D'
          3        SEND_VAL                                                 'type%3D%22full%22%5D'
          4        INIT_FCALL                                               'preg_replace'
          5        SEND_VAL                                                 '%2F%5C%5Bsection%28%5B%5E%5C%5D%5D%2B%29%28%3F%21type%29%5C%5D%2Fi'
          6        SEND_VAL                                                 '%5Bsection%241+type%3D%22wrapper%22%5D'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                         $3      
         11        ASSIGN                                                   !0, $3
    7    12        CONCAT                                           ~5      'First+try%3A+', !0
         13        CONCAT                                           ~6      ~5, '%0A'
         14        ECHO                                                     ~6
   11    15        ASSIGN                                                   !0, '%5Bsection+title%3D%22This+is+the+title%22+type%3D%22full%22%5D'
   13    16        INIT_FCALL                                               'str_replace'
         17        SEND_VAL                                                 'type%3D%22full%22+type%3D%22wrapper%22%5D'
         18        SEND_VAL                                                 'type%3D%22full%22%5D'
         19        INIT_FCALL                                               'preg_replace'
         20        SEND_VAL                                                 '%2F%5C%5Bsection%28%5B%5E%5C%5D%5D%2B%29%28%3F%21type%29%5C%5D%2Fi'
         21        SEND_VAL                                                 '%5Bsection%241+type%3D%22wrapper%22%5D'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $8      
         24        SEND_VAR                                                 $8
         25        DO_ICALL                                         $9      
         26        ASSIGN                                                   !0, $9
   15    27        CONCAT                                           ~11     'First+try%3A+', !0
         28        CONCAT                                           ~12     ~11, '%0A'
         29        ECHO                                                     ~12
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.88 ms | 1396 KiB | 17 Q