3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ 'key1' => [ 'first string' ], 'key2' => [ 'second array' ] ]; $array2 = [ 'key1' => [ 'new string from second array' ], 'key2' => [ 'second key in this other multidimensional array' ] ]; $outer_string = "Hello, this is my first string\nAnd here you can see another string from my second array"; $replacements = array(); foreach ($array1 as $k => $v) { $replacements[$v[0]] = $array2[$k][0]; } echo strtr($outer_string, $replacements);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/FETqi
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array1, !1 = $array2, !2 = $outer_string, !3 = $replacements, !4 = $v, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   20     2        ASSIGN                                                   !2, 'Hello%2C+this+is+my+first+string%0AAnd+here+you+can+see+another+string+from+my+second+array'
   21     3        ASSIGN                                                   !3, <array>
   22     4      > FE_RESET_R                                       $10     !0, ->13
          5    > > FE_FETCH_R                                       ~11     $10, !4, ->13
          6    >   ASSIGN                                                   !5, ~11
   23     7        FETCH_DIM_R                                      ~13     !4, 0
          8        FETCH_DIM_R                                      ~15     !1, !5
          9        FETCH_DIM_R                                      ~16     ~15, 0
         10        ASSIGN_DIM                                               !3, ~13
         11        OP_DATA                                                  ~16
   22    12      > JMP                                                      ->5
         13    >   FE_FREE                                                  $10
   25    14        INIT_FCALL                                               'strtr'
         15        SEND_VAR                                                 !2
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $17     
         18        ECHO                                                     $17
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150 ms | 1010 KiB | 14 Q