I have PHP code which shows post text. Sometimes this post text content contains user mentions like @[2] where 2 is the serial number of the row for the mentioned user in the user table in my database. Suppose this user has username @mark.
I want to replace this mention code @[2] with a user profile link, for example <a href="https://example.com/mark">@mark</a>
Like take value 2 from @[2] string. This value is a variable Find respected row in user table in database for Show username and user profile link instead of @[2].
@[2]instead of@name? How would users know the database-internal index no? Is this question about linkifying those placeholders, or about doing the database lookups (=too broad)?