I am currently making a tag system within my profile page of my website. If the user specifies: +tag[username]
where username is equal to a username that the person is friends with, it will preg_replace the tag with a link to the user. Finding the +tag using strpos is easy, but the question i am asking is how to pull the username as a variable. e.g: if $text = 'hey +tag[matty] how are you!'
if (strpos($text, '+tag[//username//]' !== false)) {
//get //username// and store as $username
}
so that it would look like this:
if (strpos($text '+tag[//username//]' !== false) {
$username = "matty";
}
thankyou to all who reply in advance :)