When you've finished using the opened file, you must close it before you move on to new work. It is an easy function with one parameter to be passed, the file pointer which was used when opening the file.
<?php fclose( $fp ); ?>
So, there is nothing much to talk about this function. We shall sum up the content we learnt to this point with the following example:
<?php $inputString = "This is the first line.\nThis is the seconds line.\nThis is the third line.";