3v4l.org

run code in 300+ PHP versions simultaneously
<?php $optimization_prompt = '[not a key] The product title is [title] and the price is [price] and this product link is [link]'; $get_product = ['title' => 'theTitle', 'price' => 45, 'link' => 'https://thelink.com']; $result = str_replace( array_map(fn($k) => "[$k]", array_keys($get_product)), $get_product, $optimization_prompt ); echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RrGo0
function name:  (null)
number of ops:  18
compiled vars:  !0 = $optimization_prompt, !1 = $get_product, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5Bnot+a+key%5D+The+product+title+is+%5Btitle%5D+and+the+price+is+%5Bprice%5D+and+this+product+link+is+%5Blink%5D'
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'str_replace'
    7     3        INIT_FCALL                                               'array_map'
          4        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          5        SEND_VAL                                                 ~5
          6        INIT_FCALL                                               'array_keys'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
    8    12        SEND_VAR                                                 !1
    9    13        SEND_VAR                                                 !0
    6    14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !2, $8
   12    16        ECHO                                                     !2
   13    17      > 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/RrGo0
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        ROPE_INIT                                     3  ~2      '%5B'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%5D'
          4      > RETURN                                                   ~1
          5*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.09 ms | 1002 KiB | 16 Q