Warning: include(nectar/meta/meta-config.php) [function.include]: failed to open stream: No such file or directory in /home/content/18/9019618/html/v2014/wp-content/themes/salient/functions.php on line 4650

Warning: include() [function.include]: Failed opening 'nectar/meta/meta-config.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/18/9019618/html/v2014/wp-content/themes/salient/functions.php on line 4650
Are You Making These Four Simple PHP Mistakes?

Are You Making These Four Simple PHP Mistakes?

By July 10, 2015 Blog No Comments
Are You Making These Four Simple PHP Mistakes?

Whether because you’re in a hurry or you’ve been actually taught wrong, PHP mistakes happen more often than most professional developers are willing to admit. Read on to find out what the most common mistakes are, and how to avoid them, so you don’t have to learn the hard way. Some of the mistakes are ridiculously simple and easy to avoid, while others are a bit harder to spot even with strict error reporting.

Don’t Suppress Notices

Notices and warnings will not bring the execution of your application to a halt; instead, they’ll simply be displayed on the screen or written to the error log, depending on your settings. Many developers consider @ to be shorthand for “ignore,” which makes it one of the most overlooked PHP mistakes out there. If you find yourself using the @ operator, reconsider your approach and try to solve the problem at hand. Not only will solving the problem speed up your application, because it won’t have to log so many errors, but it will also help you build a reputation of an established, reliable developer.

Are You Making These Four Simple PHP Mistakes?Buy Theme Open Demo

PHP Mistakes When Using Quotes

While using double quotes might seem like the easier and quicker way to write code, you should definitely reconsider this approach. Both single and double quotes are used to specify strings, but they’re far from being the same. We use single quotes when we want the string to be just the way it was written, and PHP won’t interpret or evaluate it. When using double quotes, the variables in the string will be interpreted and replaced by their values. Using only double quotes is one of the most common PHP mistakes you should try to avoid – in other words, use single quotes unless there’s a specific need for the functionality provided by the double quotes.

Not Using Database Caching

Data caching is basically storing a PHP variable inside the cache and accessing it later from cache. If you’re not using a database in your PHP, you should at least consider using some sort of database caching, because it will significantly improve your application. However, you need to keep in mind that the variable will stay in cache forever, unless you set an expiration date, or remove it manually.

Are You Making These Four Simple PHP Mistakes?Buy Theme Open Demo

Not Setting Time Limits On PHP Scripts

When a PHP script is executed, developers often assume the script will run its course and end in a timely manner. However, how many times have you run into an unresponsive script in your everyday life? You can easily avoid this simple PHP mistake by simply setting a time limit on the script (set_time_limit).

Leave a Reply