Friday, October 13, 2017

5 Reasons Companies MUST consider upgrading to PHP7(at least)

Hello, Readers.
I am back to my blog since long time away. Now i have some free time, so i will make sure to add up interesting articles :-)
Following is AT LEAST 5 reasons that should convince you to upgrade.

1) Cut Expenses
Company will cut expenses by cutting down the memory usage, because PHP7 have implemented an optimized memory management when using lot of things, including, most usable - ARRAYS ! Lets take as an example generating 100,000 integers array and show the difference between PHP < 7 and PHP > 7.
$amount = 100000;
$beginMemory = memory_get_usage();
$array = [];
for ($i = 0; $i < $amount; $i++) {
   $array[$i] = $i;
}
$endMemory = memory_get_usage();
$memoryUsed = ceil(($endMemory - $beginMemory) / (1024*1024));
echo "memory = {$memoryUsed} MB";
In this case, depends on the machine, but mine is 64bit, so the result is following:
PHP5.6 - 14MB
PHP7 - 4MB


This argument, in my opinion, over weights any other reasons, so that i wrote it at first place.
May save companies hundreds of bucks in case application is memory intensive.
In case when developer chooses using SplFixedArray, this saving on expenses might reach X10 and even more.
If one, uses SplFixedArray for the code above, the overall memory consumption might reach as low as 2MB ! Feel the difference !

2) Easier hiring process
You would ask HOW? I will answer.
We are, as developers, usually tend to better/latest technologies, just because we understand that the old technology will leave us in the old world after for example 3 years. This leads us to think that after years working using old technologies, when we will back to job market - almost nobody will need us, because during recent years, most of companies have advanced, but we, as professionals, left behind and have to catch up...

3) Speed up your application
Literally like that. PHP7 out of the box is speeding up application by twice or triple of PHP5.6 on average.
As of writing this article, PHP7.1.10 is on market and 7.2 on its way as RC4 (next RC release on 26 October 2017 and final version will come very soon).

4) Improve code readability
PHP7 brought to us strict data typing, which bring us even more execution speeds and highly improved code readability.
Improved code readability will save development time, telling you as developer myself.

5) Security
PHP7 has better understanding that security matter and added new way algorithms to hash password and many more features that help solve security issues.

P.S. PHP 5.6 upgrading to PHP7 does not takes much, in case you don't have PHP4 mysql_* functions usage in code:) and you are not turning on strict data typing by default.
Enjoy the reading, and read more in google.
Also don't trust me wisely - benchmark youself first.

No comments: