PHP Write HTML tags into file and display it

I want to make a simple comment system in PHP and my problem is when the user type ‘<' it disappear because it takes it to HTML code and mess my code. So what I need to do, when the user type this ...