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(array_keys($keys), array_values($values), $template); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 27
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/3hA0D
function name:  (null)
number of ops:  29
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, ->27
         12    > > FE_FETCH_R                                       ~18     $17, !5, ->27
         13    >   ASSIGN                                                   !6, ~18
   34    14        INIT_FCALL                                               'preg_replace'
         15        INIT_FCALL                                               'array_keys'
         16        SEND_VAR                                                 !6
         17        DO_ICALL                                         $20     
         18        SEND_VAR                                                 $20
         19        INIT_FCALL                                               'array_values'
         20        SEND_VAR                                                 !5
         21        DO_ICALL                                         $21     
         22        SEND_VAR                                                 $21
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $22     
         25        ASSIGN                                                   !7, $22
   32    26      > JMP                                                      ->12
         27    >   FE_FREE                                                  $17
   35    28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.52 ms | 1396 KiB | 19 Q