Sum of first 20 even number in PHP Code
Things that we are taking care of is time complexity and space complexity while writing the code.
The code in PHP Language to calculate the sum of the first 20 even number in PHP Code
This is a standard programming question which is asked at various levels to collect the thought process of the candidate or the one that is trying to unravel the matter.
There are various ways we will solve this problem and that we must look out of the boundaries for an equivalent.
Time Complexity: O(1)
Space Complexity: O(1)
You can also look at our article about PHP Clean Code Tips and Good Programming Things To Remember