PHP get_current_user () Function Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The get_current_user() function is an inbuilt function in PHP that returns the owner of the current script. Syntax: string get_current_user()Parameters: This function does not accept any parameter. Return Value: This function returns the username of the current script in the string format. Example 1: In this example, we will print the current user name using the get_current_user() function. PHP <?php echo 'Current script owner: ' . get_current_user(); ?> Output: Current script owner: dachman Note: The name will be different according to your system name. Example 2: In this example, we will check the user with an 'if statement'. PHP <?php $name = get_current_user() ; if($name == "dachman"){ echo "Current user name is dachman" ; } else { echo "Current user name is not found" ; } ?> Output: Current user name is dachman Reference: https://www.php.net/manual/en/function.get-current-user.php Comment More infoAdvertise with us Next Article PHP get_current_user () Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Options-info Similar Reads PHP current() Function The current() function is an inbuilt function in PHP. It is used to return the value of the element in an array which the internal pointer is currently pointing to.The current() function does not increment or decrement the internal pointer after returning the value.In PHP, all arrays have an interna 2 min read PHP | Gmagick current() Function The Gmagick::current() function is an inbuilt function in PHP which is used to return the reference of the current Gmagick object. This function does not create any copy but returns the same instance of Gmagick. Syntax: Gmagick Gmagick::current( void ) Parameters: This function doesnât accept any pa 1 min read PHP | Imagick current() Function The Imagick::current() function is an inbuilt function in PHP which is used to return the reference of current Imagick object. This function does not create any copy but returns the same instance of Imagick. Syntax: Imagick Imagick::current( void ) Parameters: This function does not accepts any para 2 min read PHP SplFixedArray current() Function The SplFixedArray::current() function is an inbuilt function in PHP which is used to get the current entry of the array. Syntax: mixed SplFixedArray::current() Parameters: This function does not accept any parameter. Return Value: This function returns the current entry of the array. Below programs 1 min read PHP | call_user_func() Function The call_user_func() is an inbuilt function in PHP which is used to call the callback given by the first parameter and passes the remaining parameters as argument. It is used to call the user-defined functions. Syntax: mixed call_user_func ( $function_name[, mixed $value1[, mixed $... ]]) Here, mixe 2 min read Like