Magento list of modules

In this post I will show you how to get the list of Magento modules from all the code pools.
Magento code pools: 

  • core
  • community
  • local

Returned array will look like: