the easiest (albeit not necessarily the best) way would be to define them within an array as in
$const = array(
'One' => 1,
'Two' => 2,
);
Then you'd call them as $const['One']
, $const['Two']
, etc.
If these constants need to be available everywhere, you could set up a helper function that gets loaded on every controller that looks like this
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function get_constants()
{
$const = array(
'One' => 1,
'Two' => 2,
'Copyright' => '2018. YourCompany, LLC',
'Creator' => 'Your name here',
);
return $const;
}
Load the helper everywhere and then you can just use it like this:
$constants = get_constants();
echo $constants['Creator']; // outputs 'Your name here'
There's more standard ways, but this is by far the easiest AFAIK