I want to place the variable $all right in the middle of $code, which is HTML code that I gathered from another file. My current code is like this.
ob_start();
---code here---
$all = ob_get_clean();
$code = file_get_contents("file.txt");
echo $code;
file.txt would look a little something like this.
<html>
<head>
<title>Title</title>
</head>
<body>
---HTML code here---
$all
---More HTML code---
</body>
</html>
What should I do so that when I echo $code, $all is rendered inside it?
Use
str_replaceto replace$allwith the value.