Simple Logging with PHP

Manier times we require to create logs of various activities/errors in our web applications, so here we'll look into how to achieve that.
Logging data to a file in PHP can be as simple or as complex as you want to make it. Break it down, though, and it all comes down to these three simple lines of code: