Quantcast
Channel: PHPDeveloper.org
Viewing all articles
Browse latest Browse all 10

Patrick Allaert's Blog: Readable PHP code #2 - Make your API handle more!

$
0
0

In a new post today Patrick Allaert has continued his "Readable Code" series with some tips on how you can make your API handle more.

His suggestions include:

  • Changing the handling to look for multiples by default
  • Avoiding inner looping (repeated looping) and try for code reuse
  • Transforming a scalar value into an array to make it easier to handle this way (by casting)
  • and how to handle objects in the same array-handling kind of code

He also tosses in a little mention of performance, noting that a call with range in the argument to his array-handling method is faster than looping over the same range and calling the method each time.


Viewing all articles
Browse latest Browse all 10

Trending Articles