Things that you need to avoid doing in PHP 7
4 Min. read
PHP 7 is nothing short of a revolution and it would certainly change the way we deliver the applications that power the websites, mobile enterprise and also the cloud. This is without a doubt the most powerful change for PHP in comparison to the last release back in 2004 of PHP 5. PHP 7 comes with immense performance improvements, remarkably scaled down memory consumption and also new languages feature for your applications.
Now, it is important for you to realise that PHP 7 emerged after skipping PHP 6; for the very reason features of previous versions are removed and some new are added. So, it becomes important for you to avoid few things in PHP 7.
Remember not to use mysql_funtions
Now is the time for you to stop using mysql_functions. PHP 7 will eliminate it (mysql_functions) from its core all in all. You’ll have to shift to a much more remarkable mysqli_functions.
Avoid writing the Wasteful Codes
It is with the utmost importance for you to understand that there is a speed boost in PHP 7 and that could possibly withhold some of your issues. Remember never to get convinced with the speed of your site as it is because you moved to PHP 7. If you are Developer or a PHP Development Specialist it is important for you to realise that only load scripts if required, only associate when it is important, try and write database efficiently and lastly use cache only when it is necessary.
Avoid using PHP Close Tags at the end of a file
If you examine sharply, the most core WordPress files skip the ending PHP tag when a file ends with a PHP code. More importantly, ZEND framework (an open source, object oriented web application framework for PHP 5) clearly forbids it. PHP doesn’t need it and by overlooking it at the end of the file, it is important for you to make sure, that no trailing white-space can be added.
Pass by Reference if only necessary
If you are someone who practises passing by reference, you should simply avoid it. Agreed, that in rarest of the case you might do it, and makes code difficult to understand and follow and it even gets more difficult to predict the result.
Avoid using * in SQL Queries
No matter what the case, avoid using wildcards in SQL queries, and notably when you have lots of column in your database.
You should not Trust User Input
It isn’t advisable to trust the user input. It is necessary to always filter, sterilize, check and use fullbacks.
And lastly, Appreciate other Language