What is the purpose of using JURI::current() in PHP code for Joomla modules?

When developing Joomla modules in PHP, it is common to need information about the current Joomla application, such as the current menu item or the active language. The JURI::current() function is used to retrieve the current URL of the Joomla application, including any query parameters. This function is useful for creating dynamic links or performing actions based on the current URL.

// Get the current URL using JURI::current()
$currentUrl = JUri::current();

// Output the current URL
echo "Current URL: " . $currentUrl;