$menuLabel = "{{WELCOME_MESSAGE}}, {{LOGGED_IN_USERNAME}}"; $welcomeMessage = "Welcome to my website!"; $parsedLabel = parseMenuLabel($menuLabel);
echo $parsedLabel;
In the example above, the function will replace {{WELCOME_MESSAGE}} with the value of $welcomeMessage, and {{LOGGED_IN_USERNAME}} with the logged-in user's username (if the user is logged in). The resulting string will be echoed to the page.