3v4l.org

run code in 300+ PHP versions simultaneously
<?php $template = ' <div style="border:1px solid blue;padding:10px;"> <h1>[item_title]</h1> <p>[item_text]</p> <a href="[item_link]">[item_link]</a> </div> <div style="border:1px solid blue;padding:10px;"> <h1>[item_title]</h1> <p>[item_text]</p> <a href="[item_link]">[item_link]</a> </div> '; /// ITEM 1 $title = 'title 1'; $text = 'text text text'; $link = 'http://www.google.com'; /// ITEM 2 $title = 'title 2'; $text = 'text2 text2 text2'; $link = 'http://www.google.com'; $regex = array( '/\[\item_title\]/is' => $title, '/\[\item_text\]/is' => $text, '/\[\item_link\]/is' => $link, ); foreach($regex as $keys => $values) { $temp = preg_replace($keys, $values, $template); } echo $temp;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/Dl27l
function name:  (null)
number of ops:  24
compiled vars:  !0 = $template, !1 = $title, !2 = $text, !3 = $link, !4 = $regex, !5 = $values, !6 = $keys, !7 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%0A%3Cdiv+style%3D%22border%3A1px+solid+blue%3Bpadding%3A10px%3B%22%3E%0A%3Ch1%3E%5Bitem_title%5D%3C%2Fh1%3E%0A%3Cp%3E%5Bitem_text%5D%3C%2Fp%3E%0A%3Ca+href%3D%22%5Bitem_link%5D%22%3E%5Bitem_link%5D%3C%2Fa%3E%0A%3C%2Fdiv%3E%0A%0A%3Cdiv+style%3D%22border%3A1px+solid+blue%3Bpadding%3A10px%3B%22%3E%0A%3Ch1%3E%5Bitem_title%5D%3C%2Fh1%3E%0A%3Cp%3E%5Bitem_text%5D%3C%2Fp%3E%0A%3Ca+href%3D%22%5Bitem_link%5D%22%3E%5Bitem_link%5D%3C%2Fa%3E%0A%3C%2Fdiv%3E%0A'
   17     1        ASSIGN                                                   !1, 'title+1'
   18     2        ASSIGN                                                   !2, 'text+text+text'
   19     3        ASSIGN                                                   !3, 'http%3A%2F%2Fwww.google.com'
   22     4        ASSIGN                                                   !1, 'title+2'
   23     5        ASSIGN                                                   !2, 'text2+text2+text2'
   24     6        ASSIGN                                                   !3, 'http%3A%2F%2Fwww.google.com'
   27     7        INIT_ARRAY                                       ~15     !1, '%2F%5C%5B%5Citem_title%5C%5D%2Fis'
   28     8        ADD_ARRAY_ELEMENT                                ~15     !2, '%2F%5C%5B%5Citem_text%5C%5D%2Fis'
   29     9        ADD_ARRAY_ELEMENT                                ~15     !3, '%2F%5C%5B%5Citem_link%5C%5D%2Fis'
   26    10        ASSIGN                                                   !4, ~15
   32    11      > FE_RESET_R                                       $17     !4, ->21
         12    > > FE_FETCH_R                                       ~18     $17, !5, ->21
         13    >   ASSIGN                                                   !6, ~18
   34    14        INIT_FCALL                                               'preg_replace'
         15        SEND_VAR                                                 !6
         16        SEND_VAR                                                 !5
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $20     
         19        ASSIGN                                                   !7, $20
   32    20      > JMP                                                      ->12
         21    >   FE_FREE                                                  $17
   37    22        ECHO                                                     !7
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.73 ms | 1388 KiB | 15 Q