3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ["{A}", "{B}", "{C}", "{A}"]; $start = '<span class="c">'; $end = '</span>'; $string = "{A}{B}{C}{A}"; foreach (array_unique($arr) as $item) { $string = str_replace($item, $start . $item . $end, $string); } echo $string;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/mNjbu
function name:  (null)
number of ops:  21
compiled vars:  !0 = $arr, !1 = $start, !2 = $end, !3 = $string, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, '%3Cspan+class%3D%22c%22%3E'
    4     2        ASSIGN                                                   !2, '%3C%2Fspan%3E'
    5     3        ASSIGN                                                   !3, '%7BA%7D%7BB%7D%7BC%7D%7BA%7D'
    7     4        INIT_FCALL                                               'array_unique'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $9      
          7      > FE_RESET_R                                       $10     $9, ->18
          8    > > FE_FETCH_R                                               $10, !4, ->18
    8     9    >   INIT_FCALL                                               'str_replace'
         10        SEND_VAR                                                 !4
         11        CONCAT                                           ~11     !1, !4
         12        CONCAT                                           ~12     ~11, !2
         13        SEND_VAL                                                 ~12
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !3, $13
    7    17      > JMP                                                      ->8
         18    >   FE_FREE                                                  $10
   11    19        ECHO                                                     !3
   12    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.53 ms | 1395 KiB | 17 Q