I'm currently working on a PHP project and I am trying to use the `fwrite()` function to write a variable as a string. I've been researching and trying different methods, but I can't seem to get it right.
Here's a bit of context: I have a variable called `$message` which holds a string. I want to write the contents of this variable into a file using `fwrite()`. Can someone please guide me on how to achieve this?
I'd really appreciate any help or sample code snippets that can illustrate the proper usage of `fwrite()` in this context. Thanks in advance!