3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'This thing should output _$this_key$_ and also _$this_one$_ so that I can match it with an array!'; $replacements = [ 'this_key' => 'love', 'this_one' => 'more love' ]; $start = '_$'; $end = '$_'; $replacements = array_combine(array_map(function ($v) use ($start, $end) { return "$start$v$end"; }, array_keys($replacements)), $replacements); echo strtr($str, $replacements);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QCJSb
function name:  (null)
number of ops:  25
compiled vars:  !0 = $str, !1 = $replacements, !2 = $start, !3 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'This+thing+should+output+_%24this_key%24_+and+also+_%24this_one%24_+so+that+I+can+match+it+with+an+array%21'
    4     1        ASSIGN                                                   !1, <array>
    8     2        ASSIGN                                                   !2, '_%24'
    9     3        ASSIGN                                                   !3, '%24_'
   10     4        INIT_FCALL                                               'array_combine'
          5        INIT_FCALL                                               'array_map'
          6        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
          7        BIND_LEXICAL                                             ~8, !2
          8        BIND_LEXICAL                                             ~8, !3
          9        SEND_VAL                                                 ~8
         10        INIT_FCALL                                               'array_keys'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $9      
         13        SEND_VAR                                                 $9
         14        DO_ICALL                                         $10     
         15        SEND_VAR                                                 $10
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $11     
         18        ASSIGN                                                   !1, $11
   11    19        INIT_FCALL                                               'strtr'
         20        SEND_VAR                                                 !0
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $13     
         23        ECHO                                                     $13
         24      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QCJSb
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $v, !1 = $start, !2 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        ROPE_INIT                                     3  ~4      !1
          4        ROPE_ADD                                      1  ~4      ~4, !0
          5        ROPE_END                                      2  ~3      ~4, !2
          6      > RETURN                                                   ~3
          7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
245.73 ms | 1006 KiB | 17 Q