3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = 'Aenean lacinia bibendum <a href="/life">life</a> sed consectetur. <a href="/work">Work</a> quis risus eget urna mollis ornare <a href="/about">about</a> leo. <h1> attribute="whatever">asiponfpweg ihnasegio</h1>asd <p>whatever</p> <img src=""></img> <h3> attribute="whatever">asiponfpweg ihnasegio</h3> <p>whatever</p> <p>whatever</p> <h1><span> attribute="whatever">asiponfpweg ihnasegio</span></h3> <p>whatever</p> <h3> attribute="whatever">asiponfpweg ihnasegio</h3>'; echo preg_replace('/<h\d.+?(?=<h\d|$)/s', '<div>$0</div>', $html);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K8h0P
function name:  (null)
number of ops:  8
compiled vars:  !0 = $html
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Aenean+lacinia+bibendum+%3Ca+href%3D%22%2Flife%22%3Elife%3C%2Fa%3E+sed+consectetur.+%3Ca+href%3D%22%2Fwork%22%3EWork%3C%2Fa%3E+quis+risus+eget+urna+mollis+ornare+%3Ca+href%3D%22%2Fabout%22%3Eabout%3C%2Fa%3E+leo.%0A%3Ch1%3E+attribute%3D%22whatever%22%3Easiponfpweg+ihnasegio%3C%2Fh1%3Easd%0A%3Cp%3Ewhatever%3C%2Fp%3E%0A%3Cimg+src%3D%22%22%3E%3C%2Fimg%3E%0A%3Ch3%3E+attribute%3D%22whatever%22%3Easiponfpweg+ihnasegio%3C%2Fh3%3E%0A%3Cp%3Ewhatever%3C%2Fp%3E%0A%3Cp%3Ewhatever%3C%2Fp%3E%0A%3Ch1%3E%3Cspan%3E+attribute%3D%22whatever%22%3Easiponfpweg+ihnasegio%3C%2Fspan%3E%3C%2Fh3%3E%0A%3Cp%3Ewhatever%3C%2Fp%3E%0A%3Ch3%3E+attribute%3D%22whatever%22%3Easiponfpweg+ihnasegio%3C%2Fh3%3E'
   14     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%3Ch%5Cd.%2B%3F%28%3F%3D%3Ch%5Cd%7C%24%29%2Fs'
          3        SEND_VAL                                                 '%3Cdiv%3E%240%3C%2Fdiv%3E'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.01 ms | 1009 KiB | 14 Q