$username = "john.doe"; if (OC_User::userExists($username)) { echo "User " . $username . " exists."; } else { echo "User " . $username . " does not exist."; }
$userList = ["john.doe", "jane.doe", "jack.smith"]; foreach ($userList as $user) { if (OC_User::userExists($user)) { echo "User " . $user . " exists."; } else { echo "User " . $user . " does not exist."; } }This code checks if multiple users exist in the system. It loops through the $userList array and checks if each user exists. If a user exists, the message "User [username] exists" is displayed. Otherwise, the message "User [username] does not exist" is displayed. The OC_User class is part of the ownCloud package library, which is a free and open-source file sharing and collaboration platform. It provides a set of PHP libraries and API functions for developers to create custom applications and plugins for ownCloud.