How to create logs in php

Many times we need to create logs in our Web Applications to track any certain Errors or Response. We just need to put a bunch of code where you want to Create a log. In this post you will learn how to create logs using Php Code.

This code will check for the filename. If its available then it will write into the file and if code does not find the file it will create the new for of given name and will write the Logs. You can also use this code in any function you want.