- Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
- [not a key] The product title is theTitle and the price is 45 and this product link is https://thelink.com
<?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;