3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.06 ms | 1000 KiB | 16 Q