How to get base directory programmatically in Magento 2

It is possible to get base directory programmatically in Magento 2 the same way as you do it in 1.x, since it is available in the constant :
|
1 |
define('BP', dirname(__DIR__)); |





