<?php $content = "And so @Nick said to @Joe, hello!\n"; $contentWithMentions = $content; preg_match_all('/\s\@\w+/',$content,$matches); foreach ($matches[0] as $match) { $contentWithMentions = str_replace("$match", '<a href="user.php?user=#">'.$match.'</a>', $contentWithMentions); } echo $contentWithMentions; $contentWithMentions = preg_replace('/\s\@\w+/', '<a href="user.php?user=#">'."$0".'</a>', $content); echo $contentWithMentions;
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`