I have the following PHP array
$menu['Settings']['user'] = array(
1 => 'General',
'database.php' => 'Database',
'users.php' => 'User Management'
);
However the entry for database.php needs to depend on if a string called $user == "Admin"
Any idea how I can put an if statement inside this array?
Use a ternary operation?
'database.php' => $user === 'Admin' ? 'Database' : 'Grumblecakes',
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