What is code security?

And also what is obfuscator? Do they have major similarities?

I have been hearing about the security issues of the code. How can we secure our code in php? How necessary is it to make our code secured and how?