If you want to replace directly, then instead of this:
$test3 = str_replace($key , $value , $html);
write this:
$html = str_replace($key , $value , $html);
and at the end, echo $html
.
Or if you want to store it in a $test3
variable, then something like this:
$test3 = $html;
foreach ( $random_name as $key => $value ) {
$test3 = str_replace($key, $value, $test3);
}
echo $test3;