3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<p id="keepthis"> text</p><div id="foo">text</div><div id="bar">more text</div><a id="red"href="page6.php">Page 6</a><a id="green"href="page7.php">Page 7</a>'; echo preg_replace_callback( '/(?<=<div|<a)( *id="[^"]+")/i', function ($match) { return " "; }, $string );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iKHR8
function name:  (null)
number of ops:  9
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cp+id%3D%22keepthis%22%3E+text%3C%2Fp%3E%3Cdiv+id%3D%22foo%22%3Etext%3C%2Fdiv%3E%3Cdiv+id%3D%22bar%22%3Emore+text%3C%2Fdiv%3E%3Ca+id%3D%22red%22href%3D%22page6.php%22%3EPage+6%3C%2Fa%3E%3Ca+id%3D%22green%22href%3D%22page7.php%22%3EPage+7%3C%2Fa%3E'
    5     1        INIT_FCALL                                               'preg_replace_callback'
    6     2        SEND_VAL                                                 '%2F%28%3F%3C%3D%3Cdiv%7C%3Ca%29%28+%2Aid%3D%22%5B%5E%22%5D%2B%22%29%2Fi'
    8     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FiKHR8%3A8%240'
   11     4        SEND_VAL                                                 ~2
   13     5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        ECHO                                                     $3
   14     8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FiKHR8%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iKHR8
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1      > RETURN                                                   '+'
   11     2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FiKHR8%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.93 ms | 1386 KiB | 15 Q