3v4l.org

run code in 500+ 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:  15
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>
    7     2        INIT_FCALL                                                   'array_map'
          3        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          4        SEND_VAL                                                     ~5
          5        INIT_FCALL                                                   'array_keys'
          6        SEND_VAR                                                     !1
          7        DO_ICALL                                             $6      
          8        SEND_VAR                                                     $6
          9        DO_ICALL                                             $7      
    6    10        FRAMELESS_ICALL_3                str_replace         ~8      $7, !1
    9    11        OP_DATA                                                      !0
    6    12        ASSIGN                                                       !2, ~8
   12    13        ECHO                                                         !2
   13    14      > 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:/in/RrGo0:7}
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.5.0


preferences:
158.86 ms | 1728 KiB | 15 Q