- 1464 -

Manipulating arrays with callback functions and Collections

In addition to the previous point, to handle arrays and their elements in PHP (php company), 2 other concepts are interesting. I do not (yet) master them enough to go into too much detail.

The array_map, array_filter or array_reduce functions allow you to process arrays by applying callback functions. We can therefore do without for or foreach while processing all the elements of the array

Collections are third-party libraries, for example very popular in Laravel, which will allow you to manipulate arrays in object logic to have something more readable and pleasant than the functions above:

2 examples in English (the other good practices in this article are also very interesting)
A tutorial in French
The "collect" bookstore on Github
Similar things can be found in other PHP frameworks as well.

Personally, I am always attracted by these programming challenges, it is a good opportunity to rub shoulders with algorithmic complexities, and therefore to dig into the language + in depth, to discuss with other developers on the solutions found, to discover practices, tips, etc. It really allows you to progress as a developer. 2021 is just beginning, I wish you all a very happy new year, rich in code, and good programming practices!


  1. 4 Août 2022PHP Website Development: How Long Does It Take?98
  2. 8 Juil. 2022PHP Development Team: What Does It Consist Of?371
  3. 27 Juin 2022Working in a web design agency260
  4. 8 Juin 2022PHP Developer Careers: What to Expect398
  5. 15 Mai 2022Is it Profitable to Do a PHP Job and Service in Canada?463
  6. 30 Oct. 2021What is the Enigma of Cladx?2710
  7. 2 Sept. 2021Help Wanted: PHP Development Company is Looking for Skilled Workers1325
  8. 5 Août 2021A Programmer's Guide to PHP686
  9. 14 Mai 2021So what is web development in 2021 ?2332
  10. 14 Avril 2021A perfect means of goal management3381
  11. 21 Fév. 2021The intersection of several arrays6337
  12. 9 Janv. 2021Keep up to date with the latest Php releases1452