4 Useful PHP Tips That You Might Not Know About

PHP is pretty awesome given the tricks and functions you can use. Yes, making numbers and dates look cool is also a possibility. But that’s not all.

There are several other awesome things you can do with PHP. That said, here are 4 tips about PHP that you didn’t know about and might be useful:

1: The checkdnrr() Function

The checkdnrr() function serves a cool purpose. It takes an email and checks to see if it resolves as an IP address. This can useful before sending emails as it validates the domain name. This will help you save both server resources and time too. Apart from this, validating email addresses with filters also exists.

myphpnet2: MySQLI

MySQLI takes all the MySQL functions and adds them to a table for you to use immediately. This can prevent you rewriting them several times over. That said, MySQLI makes database transactions simple since the hard work is complete. There’s no doubt you’ll benefit using MySQLI.

3: Closing PHP tag Not Necessary

This is true. You don’t need that closing PHP tag at the end of a file or in any file that contain only PHP code. Of course, you will need the ‘?>’ if the file does contain non-PHP code. So, get used to leaving it out as it can cause issues in certain circumstances. One example would be when you output XML.

4: Adding Comments

If you don’t add comments to your code, your skill as a programmer is not complete. In fact, people won’t take your code with any seriousness at all. While it is simple to do this, it’s vital so that others can understand your code.