3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<div class="wrap"> <div class="wp-checkbox" data-value="zf">content</div> <div class="wp-checkbox" data-value="tdp">content</div> </div>'; $pattern = '/=\"zf\">.*?<\/div>/'; $pattern2 = '/=\"tdp\">.*?<\/div>/'; $html = preg_replace( $pattern, '="zf">new content of div</div>', $html ); $html = preg_replace( $pattern2, '="tdp">new content of another div</div>', $html ); echo $html;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jRjIB
function name:  (null)
number of ops:  17
compiled vars:  !0 = $html, !1 = $pattern, !2 = $pattern2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%22wrap%22%3E%0A%3Cdiv+class%3D%22wp-checkbox%22+data-value%3D%22zf%22%3Econtent%3C%2Fdiv%3E%0A%3Cdiv+class%3D%22wp-checkbox%22+data-value%3D%22tdp%22%3Econtent%3C%2Fdiv%3E%0A%3C%2Fdiv%3E'
    8     1        ASSIGN                                                   !1, '%2F%3D%5C%22zf%5C%22%3E.%2A%3F%3C%5C%2Fdiv%3E%2F'
    9     2        ASSIGN                                                   !2, '%2F%3D%5C%22tdp%5C%22%3E.%2A%3F%3C%5C%2Fdiv%3E%2F'
   10     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 '%3D%22zf%22%3Enew+content+of+div%3C%2Fdiv%3E'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !0, $6
   11     9        INIT_FCALL                                               'preg_replace'
         10        SEND_VAR                                                 !2
         11        SEND_VAL                                                 '%3D%22tdp%22%3Enew+content+of+another+div%3C%2Fdiv%3E'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !0, $8
   13    15        ECHO                                                     !0
   14    16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.1 ms | 1399 KiB | 15 Q