How can a user profile link be dynamically generated in PHP code?
To dynamically generate a user profile link in PHP code, you can use a combination of concatenation and interpolation to insert the user's ID into the link URL. This ensures that each user's profile link is unique and can be easily accessed.
<?php
// Assuming $userID contains the user's ID
$userID = 123;
// Generate the user profile link dynamically
$userProfileLink = "https://example.com/profile.php?id={$userID}";
// Output the user profile link
echo '<a href="' . $userProfileLink . '">View Profile</a>';
?>