readfile() says it outputs the content but I want the content to be saved in a variable. How do I do that? I tried $content=readfile("file.txt") but that doesn't come out right.
I want to do like this:
$data=readfile("text.txt");
echo htmlentities($data);
That should give you an idea of how I want that to work.
readfileandfile_get_contentsare for doing two different things and what you want to do is exactly whatfile_get_contentsis for, not whatreadfileis for.