$res = preg_replace('/(?<=\A|\W)@([\w]+)/ius', '<a href="/users/$1">@$1</a>', $text);
$text = '@user_first123 Example text with @user_login123 and #tag and email asdasd@gmail.com';
$res = preg_replace('/(?:\A|\W)@([\w]+)/ius', '<a href="/users/$1">@$1</a>', $text);
$res = preg_replace('/#([\w]+)/ius', '<a href="/tags/$1">#$1</a>', $res);
var_dump($text, $res);
string '@user_first123 Example text with @user_login123 and #tag and email asdasd@gmail.com' (length=83)
string '<a href="/users/user_first123">@user_first123</a> Example text with<a href="/users/user_login123">@user_login123</a> and <a href="/tags/tag">#tag</a> and email asdasd@gmail.com' (length=176)
toxa@vinga:~$ php -r "var_export(explode('|', '1|3|4||||4|||'));"
array (
0 => '1',
1 => '3',
2 => '4',
3 => '',
4 => '',
5 => '',
6 => '4',
7 => '',
8 => '',
9 => '',
)
if (!empty($ip_addr) && filter_var($ip_addr, FILTER_VALIDATE_IP)) {
$pr_ip = explode(".", $ip_addr);
$my_ip = $pr_ip[0].$pr_ip[1].$pr_ip[2];
} else {
$my_ip = '';
}
var data = $(this).serialize();
let btnData = $('#games_sorted').val();
console.log(data + '&games_sorted_name=' + btnData);