Php helps you to quickly build big applications and many times, its easy to neglect the security matter. Its easy to believe that security breaches could not happen to your software. But what if it does happen? For this reason, security in your applications should be kept in consideration from the beginning.
Obviously, it's not necessary to use any of the code mentioned above. Even myself do not use all these strategies in any code I am writing. But it is quite possible that using some of these strategies can keep you out of some big trouble. No, having your scripts exploited is not a certain thing, but it is a possibility you must consider. And the above examples are, by no means, difficult to implement. Please do not read this and believe it is a complete guide for securing your PHP applications, it is just a small piece of a larger puzzle.