Welcome Guest, Not a member yet? Register   Sign In
Define/include "globally available" arrays and functions
#2

For your array of currencies, define a new config file. You can load it anywhere you need it.
PHP Code:
// load the file
$config config('MyConfig');

// get some values...
$config->currencies

For your functions, if it's only simple functions, create a helper file. If it's more complicated and you need a class, maybe create a library.

Also, have a look at the number_to_currency function in the number helper: http://codeigniter.com/user_guide/helper...o_currency
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
RE: Define/include "globally available" arrays and functions - by includebeer - 06-05-2021, 03:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB