$user = context_user(); echo "Current user: $user";
if (context_user() == 'admin') { // do something for admins only }This code checks if the context user is 'admin' and performs an action if the condition is true. The context_user function is part of the PHP core library and does not require any external package library.