- print_r: documentation ( source)
- preg_match_all: documentation ( source)
- array_shift: documentation ( source)
<?php
$text = "text @user text @Губка Боб text @user1 text text @SiteTe.ru text text text @любитель text text @guba bob text text @geb 123";
if (preg_match_all('~(?=(?<!\S)(@.{0,29}))~u', $text, $matches)) {
array_shift($matches);
print_r($matches[0]);
}