I want to add implementation of array_column() for CakePHP app that is currently running on PHP 5.3 (array_column() has been introduced in PHP 5.5). What would be the best method of doing it without touching core files?
Please note that I don't want to use helper, I really want to define global function.
If you don't want to write a helper there are a few places where you can put global functions. If you're going to use the functions only in your controllers the best place is the AppController. In a similar way you could use the AppModel class for model functions and for the views you could put them within a layout.
But if you want to use the functions across the entire application, I would recommend putting them inside the app/Config/bootstrap.php file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With