The preg_match function and its conditions…

Hello, I have a question.
I have this line

preg_match("/^((?:\%?\<[^\>]{2,20}\>\s?)+)(.*?)$/", $msg, $arr);

it will seed a message like “<Word> word” or “%<Word> word”
splits it into an array
there is also a second condition

preg_match("/^((?:\%clan%\s?)+)(.*?)$/", $msg, $arr);

It will seed a message like “%clan% word”, “%clan% <Word> word”, or “%clan% %<Word> word”
Combining these 2 conditions, I got

preg_match("/^((?:\%clan\%\s?)?(?:\%?\<[^\>]{2,20}\>\s?)?+)(.*?)$/", $msg, $arr);

but there is one minus if these conditions “%clan% word”, “%clan%<word> word”, “%<word> word” or “<word> word” and so on are not present. then it creates an array from a simple “word” where the variable $arr[2]is empty, but how to make sure that $arris not created at all?


Answer 1, authority 100%

if(empty($arr[2])){
unset($arr);
}

not?
*trollface*