3v4l.org

run code in 300+ PHP versions simultaneously
<?php $in = 'item1, item2, item3'; $out = preg_replace('/([^,]+),?/', '$1 <img src="$1.png" alt="$1" />', $in); echo $out;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hQVCW
function name:  (null)
number of ops:  9
compiled vars:  !0 = $in, !1 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'item1%2C+item2%2C+item3'
    5     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%28%5B%5E%2C%5D%2B%29%2C%3F%2F'
          3        SEND_VAL                                                 '%241+%3Cimg+src%3D%22%241.png%22+alt%3D%22%241%22+%2F%3E'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    7     7        ECHO                                                     !1
          8      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.64 ms | 1393 KiB | 15 Q