3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '%(?<attr>src|href)="(?<host>.*?)(?<media>/media/[^"]+)"%i'; $content = <<<CONTENT <p><img alt="" src="/media/images/logo_medias/TV/TF1.jpg" style="height:22px; width:60px" />&nbsp;&nbsp;<img alt="" src="/media/images/logo_medias/TV/W9.jpg" style="height:22px; width:60px" />&nbsp; <img alt="" src="/media/images/logo_medias/TV/Gulli.jpg" style="height:29px; width:30px" /><strong>&nbsp;</strong><img alt="" src="/media/images/logo_medias/TV/DISNEY%20CHANNEL.jpg" style="color:rgb(76, 76, 76); font-size:15.555556297302246px; height:40px; line-height:22.986112594604492px; width:44px" /><strong>&nbsp;<img alt="" src="/media/images/logo_medias/TV/NT1.jpg" style="height:29px; width:35px" /></strong>&nbsp;-&nbsp;Campagne de spots<br /> <img alt="" src="http://infoscom.umf.dev/media/images/Pluzz.jpg" style="height:219px; width:219px" /><a alt="" href="http://infoscom.umf.dev/media/images/Pluzz.jpg" style="height:219px; width:219px" /></p> CONTENT; $callback = function($match) { var_dump($match); return $match[0]; }; var_dump(preg_replace_callback($pattern, $callback, $content));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tnD8u
function name:  (null)
number of ops:  13
compiled vars:  !0 = $pattern, !1 = $content, !2 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '%25%28%3F%3Cattr%3Esrc%7Chref%29%3D%22%28%3F%3Chost%3E.%2A%3F%29%28%3F%3Cmedia%3E%2Fmedia%2F%5B%5E%22%5D%2B%29%22%25i'
    6     1        ASSIGN                                                   !1, '%0A%3Cp%3E%3Cimg+alt%3D%22%22+src%3D%22%2Fmedia%2Fimages%2Flogo_medias%2FTV%2FTF1.jpg%22+style%3D%22height%3A22px%3B+width%3A60px%22+%2F%3E%26nbsp%3B%26nbsp%3B%3Cimg+alt%3D%22%22+src%3D%22%2Fmedia%2Fimages%2Flogo_medias%2FTV%2FW9.jpg%22+style%3D%22height%3A22px%3B+width%3A60px%22+%2F%3E%26nbsp%3B+%3Cimg+alt%3D%22%22+src%3D%22%2Fmedia%2Fimages%2Flogo_medias%2FTV%2FGulli.jpg%22+style%3D%22height%3A29px%3B+width%3A30px%22+%2F%3E%3Cstrong%3E%26nbsp%3B%3C%2Fstrong%3E%3Cimg+alt%3D%22%22+src%3D%22%2Fmedia%2Fimages%2Flogo_medias%2FTV%2FDISNEY%2520CHANNEL.jpg%22+style%3D%22color%3Argb%2876%2C+76%2C+76%29%3B+font-size%3A15.555556297302246px%3B+height%3A40px%3B+line-height%3A22.986112594604492px%3B+width%3A44px%22+%2F%3E%3Cstrong%3E%26nbsp%3B%3Cimg+alt%3D%22%22+src%3D%22%2Fmedia%2Fimages%2Flogo_medias%2FTV%2FNT1.jpg%22+style%3D%22height%3A29px%3B+width%3A35px%22+%2F%3E%3C%2Fstrong%3E%26nbsp%3B-%26nbsp%3BCampagne+de+spots%3Cbr+%2F%3E%0A%3Cimg+alt%3D%22%22+src%3D%22http%3A%2F%2Finfoscom.umf.dev%2Fmedia%2Fimages%2FPluzz.jpg%22+style%3D%22height%3A219px%3B+width%3A219px%22+%2F%3E%3Ca+alt%3D%22%22+href%3D%22http%3A%2F%2Finfoscom.umf.dev%2Fmedia%2Fimages%2FPluzz.jpg%22+style%3D%22height%3A219px%3B+width%3A219px%22+%2F%3E%3C%2Fp%3E%0A'
   13     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtnD8u%3A13%240'
          3        ASSIGN                                                   !2, ~5
   18     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'preg_replace_callback'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $7      
         10        SEND_VAR                                                 $7
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FtnD8u%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tnD8u
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   15     4        FETCH_DIM_R                                      ~2      !0, 0
          5      > RETURN                                                   ~2
   16     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtnD8u%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.65 ms | 1396 KiB | 17 Q