PHP mention script
<p>I'm working on a mention script that gets an users profile link when it is being mentioned in a news article or something. I've done the mention script, but it splits the users name after it finds a space. When an user wants to mention somebody they will start their name with a @ symbol. </p>

<p>So my script stops after it finds a space. That means if I wanted to mention an username such as @This is. It would only pick up This. </p>

<p>Could anyone tell me how I can pick up usernames with spaces in? Here is my script.</p>

<pre><code>    &lt;?php

 $string = "I'm wanting to speak to the user @This is please.";
 $explosion = explode("@", $string);
 $count = count($explosion);

 for($i = 0; $i &lt; $count; $i++){
    $explosion2 = explode(" ", $explosion[$i]);
    $explosion2 = $explosion2[0];

    $string = str_replace("@{$explosion2}", "{$explosion2} yeah", $string);
 }

 echo $string;
?&gt;
</code></pre>

<p>Thank you.</p>
